Unable to blink unboard LED. (Pico and MicroPython)

RP2040 based microcontroller boards running MicroPython.
Target audience: MicroPython users with an RP2040 boards.
This does not include conventional Linux-based Raspberry Pi boards.
Post Reply
maxjon01
Posts: 4
Joined: Sun Jul 31, 2022 2:51 pm

Unable to blink unboard LED. (Pico and MicroPython)

Post by maxjon01 » Sun Jul 31, 2022 3:08 pm

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

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

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

Post by Roberthh » Sun Jul 31, 2022 3:18 pm

The shown example works causing slow blinking: 5 seconds on/5 seconds off.

maxjon01
Posts: 4
Joined: Sun Jul 31, 2022 2:51 pm

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

Post by maxjon01 » Sun Jul 31, 2022 3:35 pm

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... :(

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

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

Post by Roberthh » 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/

maxjon01
Posts: 4
Joined: Sun Jul 31, 2022 2:51 pm

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

Post by maxjon01 » Sun Jul 31, 2022 3:52 pm

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.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

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

Post by dhylands » Sun Jul 31, 2022 3:59 pm

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)

maxjon01
Posts: 4
Joined: Sun Jul 31, 2022 2:51 pm

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

Post by maxjon01 » Sun Jul 31, 2022 4:17 pm

Thanks a lot guys for the quick response! Didn't know it was different on the Pico W, but not it works :)

Post Reply