Page 1 of 1

Unable to blink unboard LED. (Pico and MicroPython)

Posted: Sun Jul 31, 2022 3:08 pm
by maxjon01
Hi. I'm just bought an Raspberry Pi Pico and the get started book. I have some issues when it comes to using the machine module. When following the books guide on how to make the onboard LED (GP25) blink, it does not work. However I tried and followed another guide using the picozero extension and then everything works. Why can't I use the machine module?

Image

Re: Unable to blink unboard LED. (Pico and MicroPython)

Posted: Sun Jul 31, 2022 3:18 pm
by Roberthh
The shown example works causing slow blinking: 5 seconds on/5 seconds off.

Re: Unable to blink unboard LED. (Pico and MicroPython)

Posted: Sun Jul 31, 2022 3:35 pm
by maxjon01
Roberthh wrote:
Sun Jul 31, 2022 3:18 pm
The shown example works causing slow blinking: 5 seconds on/5 seconds off.
Well the code should work but for some reason the LED does not light up. I've tried to let the code run for 10 minutes and nothing happens. I've also removed everything from the loop and just had:

Code: Select all

while True:
	led_onboard.value(1)
But it still will not light up. I can't understand why... :(

Re: Unable to blink unboard LED. (Pico and MicroPython)

Posted: Sun Jul 31, 2022 3:42 pm
by Roberthh
And it works with the picozero extension? Are you sure that you use a raspberry Pi Pico 2040? https://www.raspberrypi.com/products/raspberry-pi-pico/

Re: Unable to blink unboard LED. (Pico and MicroPython)

Posted: Sun Jul 31, 2022 3:52 pm
by maxjon01
Roberthh wrote:
Sun Jul 31, 2022 3:42 pm
And it works with the picozero extension? Are you sure that you use a raspberry Pi Pico 2040? https://www.raspberrypi.com/products/raspberry-pi-pico/
Yes it works with picozero. Yeah well it should be the Pi Pico W 2040, I've bought it from here. https://www.electrokit.com/produkt/raspberry-pi-pico-w/

I continued in the book and connect an external LED to pin 15 and this works perfect even with the machine module. The same code but I just changed the pin. Guess I can live without using the onboard LED, but I still think it's very strange.

Re: Unable to blink unboard LED. (Pico and MicroPython)

Posted: Sun Jul 31, 2022 3:59 pm
by dhylands
On the Pico W you need to use

Code: Select all

led = Pin('LED', Pin.OUT)
rather than

Code: Select all

led = Pin(25, Pin.OUT)

Re: Unable to blink unboard LED. (Pico and MicroPython)

Posted: Sun Jul 31, 2022 4:17 pm
by maxjon01
Thanks a lot guys for the quick response! Didn't know it was different on the Pico W, but not it works :)