Raspberry Pico trouble  - Page 1
Forum section: electronics / general

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 04, 2025, 02:32:33 pm
content: Hi everybody,I'm new to Pico and Python.In a new program I have now some utime error.So I went back to something very simple:from machine import Pinimport utimeLED = Pin(1, Pin.OUT)while True:LED.value(1)utime.sleep(1)LED.value(0)utime.sleep(1)And indeed it doesn't work and I get:Traceback (most recent call last):File "<stdin>", line 6, in <module>KeyboardInterrupt:This of course worked perfectly before. I resetted the Mac and the Pico to no avail.Any help will be much appreciated.Renaud

author: tv84
author_rank: Super Contributor
timestamp: August 04, 2025, 03:05:24 pm
content: This is not the correct forum for this question.

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 04, 2025, 04:57:24 pm
content: Sorry! i'll go somewhere else.

author: Kean
author_rank: Unknown
timestamp: August 04, 2025, 05:27:17 pm
content: Quote from: Renaud F5ZR on August 04, 2025, 04:57:24 pmThis is not related to Test Equipment, but it is still valid for other topics/sections of the forumTry under Microcontrollers -https://www.eevblog.com/forum/microcontrollers/You should be able to move your existing post. Look for a button at bottom left of the page.

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 05, 2025, 08:11:45 am
content: Apologies for the mess above.It happens too that I was mistaken. No utime problem in fact.This doesn't work either:from machine import PinLED = Pin(1, Pin.OUT)LED.value(1)LED doesn't light. I tried another GPIO output without success. The LED lights when the + is moved to +3.3V.Other programs (non GPIO) work fine.And this:from machine import Pinimport utimeLED = Pin(1, Pin.OUT)while True:LED.value(1)utime.sleep(1)LED.value(0)utime.sleep(1)Had worked before.I could try othermachine.Pinarguments?Renaud

author: newbrain
author_rank: Super Contributor
timestamp: August 05, 2025, 09:43:08 am
content: Quote from: Renaud F5ZR on August 05, 2025, 08:11:45 amJust to weed out the obvious, the on board LED on Pico boards is on GPIO 25.Do you have an external LED connected to GPIO 1?Did you try the same code with GPIO 25 instead of 1?

author: Kean
author_rank: Unknown
timestamp: August 05, 2025, 01:18:02 pm
content: Quote from: Renaud F5ZR on August 05, 2025, 08:11:45 amSo the LED doesn't light, but also no error? Or you still get an error?Do you have the LED wired with a series resistor and cathode to GND?Have you tried another GPIO in case you damaged that pin somehow?Also what version of micropython do you have?Note that newer versions of micropython can use time library instead of utime. The u prefix is no longer needed for the built-in libraries.

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 05, 2025, 04:26:47 pm
content: Thanks to you both.@ newbrain:Just to weed out the obvious, the on board LED on Pico boards is on GPIO 25.Do you have an external LED connected to GPIO 1?Did you try the same code with GPIO 25 instead of 1?Yes I did both, to no avail.@ Kean:So the LED doesn't light, but also no error? Or you still get an error?No, no error.Do you have the LED wired with a series resistor and cathode to GND?Yes, and remember this worked, same Pico, same cabling and led, same program.Have you tried another GPIO in case you damaged that pin somehow?I thought of that and I did, still to no avail.The led lights when the + is connected to +3.3V.Also what version of micropython do you have?Don't know but this worked before with utime. That was some days ago.from machine import PinLED = Pin(1, Pin.OUT)LED.value(1)What can be simpler than that?Renaud

author: Kean
author_rank: Unknown
timestamp: August 05, 2025, 06:48:34 pm
content: Measure the voltage on the output pin with a DMM, with and without the LED connected, pin set high and no toggling.

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 05, 2025, 07:10:21 pm
content: 0V Kean.I tried something else, I changed the Pico for another identical.Same result, or lack of rather.

author: Kean
author_rank: Unknown
timestamp: August 05, 2025, 07:33:00 pm
content: Just to clarify, GPIO 1 is on physical pin 2 of the Pi Pico PCB. GPIO 0 would be on physical pin 1.https://docs.micropython.org/en/latest/rp2/quickref.htmlMaybe post a photo of your setup.

author: rteodor
author_rank: Frequent Contributor
timestamp: August 05, 2025, 07:55:34 pm
content: To avoid complications just get to the REPL command prompt and see if you can control the onboard LED from there:Code:>>> from machine import Pin>>> onboard_led = Pin (25, Pin.OUT, value = 1)>>> onboard_led.off ()>>> onboard_led.on ()

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 06, 2025, 09:36:11 am
content: Quote from: Kean on August 05, 2025, 07:33:00 pmMy setup is what you say Kean. Initially it worked with GPIO 1 (pin 2).I also tried GPIO 2 (pin 4) and 3 (pin 5), nothing.Quote from: rteodor on August 05, 2025, 07:55:34 pmThanks rteodor, I'll do it.

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 06, 2025, 09:50:31 am
content: Doesn't light rteodor. What should we conclude?

author: rteodor
author_rank: Frequent Contributor
timestamp: August 06, 2025, 10:44:59 am
content: Quote from: Renaud F5ZR on August 06, 2025, 09:50:31 amSo you could get to the prompt and type commands, right ?Before considering hardware damage, check if the software is ok.Code:>>> import platform>>> platform.platform ()Should show you something like: 'MicroPython-1.24.1-arm--with-newlib4.3.0'. Post the result here, and cross check the version just in case it has a wrong image flashed.Better, reflash the uf2.If it still doesn't work then it could be hardware damage. Things to consider:- did you use your Pico in a circuit ?- may it be that it had contact with conductive/metallic surfaces ?- did you somehow use a wall power adapter/phone charger in any way that could come in contact with Pico (while also being grounded from some other place) ? Many of those adapters have AC leakage of 80-90Vac at very small current but are known to do damage.It seems strange to me that the CPU works but the pins don't.

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 06, 2025, 12:07:08 pm
content: Yes, it does to me too.It worked perfectly just some days ago, same hardware, same soft. .So I considered a hardware failure too. That's why I changed the Pico with no difference.The two pico's are on a small breadboard only ever connected to the Mac.Other programs, non GPIO connected, work perfectly.I definitely think it's soft so UF2 reflash seems a good idea though why have to picos the same behavior?

author: rteodor
author_rank: Frequent Contributor
timestamp: August 06, 2025, 12:45:38 pm
content: Another thing that crossed my mind: it could be some leftover program inside that changes the GPIO functions when booting.I do not know what environment you are using so I can only recommend you to see what files are inside with the pyboard MicroPython tool (adapt to your case):Code:python pyboard.py --device /dev/ttyACM0 -f lsIf it lists a 'main.py' then maybe check what that file does or delete it somehow.Quote from: Renaud F5ZRI'm thinking maybe because the IDE you use for programming tried to be helpful and flashed the same bad program in the second one ... !?

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 06, 2025, 12:53:01 pm
content: I tried:from machine import Pinimport utimeLED = Pin(1, Pin.OUT)while True:LED.value(1)print(LED)print(LED.value())utime.sleep(1)LED.value(0)print(LED.value())utime.sleep(1)got:MPY: soft rebootPin(GPIO1, mode=OUT)10Pin(GPIO1, mode=OUT)10Pin(GPIO1, mode=OUT)10Pin(GPIO1, mode=OUT)10Pin(GPIO1, mode=OUT)1But still led not lighted.I will investigate what you suggered

author: Renaud F5ZR
author_rank: Contributor
timestamp: August 07, 2025, 04:24:42 pm
content: I found it.While this:from machine import Pinimport utimeLED =Pin(1,Pin.OUT)while True:LED.value(1)print(LED)print(LED.value())utime.sleep(1)LED.value(0)print(LED.value())utime.sleep(1)doesn't workThis:from machine import Pinimport utimeLED =Pin(17, Pin.OUT)while True:LED.value(1)print(LED)print(LED.value())utime.sleep(1)LED.value(0)print(LED.value())utime.sleep(1)does.I must have been confused somewhere for I'm nearly sure I used the first before.Thanks to you all here.I'm sure to be back soon!Renaud

author: rteodor
author_rank: Frequent Contributor
timestamp: August 07, 2025, 07:09:26 pm
content: Maybe its because GP1 and GP17 are on the diagonal ... ?

author: Kean
author_rank: Unknown
timestamp: August 08, 2025, 04:29:05 am
content: Quote from: rteodor on August 07, 2025, 07:09:26 pmYes, GP17 is pin 22 - second pin in on the opposite corner of the Pico PCB to GP1.