Uncategorized

pico w on board LED blink

LED light not turning on

Ask Question

Asked 2 days ago

Modified today

Viewed 46 times

2

I was following this tutorial on connecting an external LED to a Pico W, but I’ve had no luck getting it to work.

This is the code I’ve been using:

import machine
from machine import Pin, Timer
timer = Timer()

led = Pin("LED", Pin.OUT)

def blink(timer):
    led.toggle()
    
timer.init(freq = 1, mode = Timer.PERIODIC, callback = blink)

Here’s a picture of what I have on the breadboard: [

I’ve tried swapping out the resistor, the LED, the jumpers, and trying all of the GPIO pins 7-15. Forgive the lousy soldering job, I’m quite new at this. My hunch is that the header pins aren’t quite on there right, but want to know if there’s something else I’m missing. Appreciate any help or ideas.

Share

EditFollowCloseFlag

asked 2 days ago

Emu_of_Ubiquity's user avatar

Emu_of_Ubiquity

1111 bronze badge

 New contributor

  • 1“Forgive the lousy soldering job” this is the most likely cause of any problems. Resolder all the dry joints, check for shorts. WHY have you soldered a resistor to the Pico? – Milliways 2 days ago
  • 1“LED” is NOT a pin. Try one of the standard beginner tutorials. This should have generated an error. – Milliways 2 days ago 
  • 1Using “LED” should flash the onboard led. Use a pin number instead of “LED” to specify your required pin. – CoderMike yesterday 
  • 1“LED” (with quotes) looks wrong. I’d expect the on-board LED to be named LED (without quotes). – joan yesterday

Add a comment

Start a bounty

2 Answers

Sorted by:

Reset to default                                              Highest score (default)                                                                   Date modified (newest first)                                                                   Date created (oldest first)                              

0

(1) For Pico W, the pin number for on board Led is “WL_GPIO0”.

Yes, no longer number 25 for Pico.

(2) The following program blinks onboard LED. The correct statement to initialize the Led should be:

LED = Pin(“WL_GPIO0”, Pin.OUT)

(3) Full listing of the folly debugged program:


# Name      - Rpi Pico W onboard LED v4.3  tlfong01  2022dec29hkt1502
# Function  - Blink onboard LED
# References -
#   (1) Blink onboard LED  https://projects.raspberrypi.org/en/projects/getting-started-with-the-pico/5
#   (2) Onboard LED pinout https://core-electronics.com.au/guides/raspberry-pi-pico/raspberry-pi-pico-w-overview-features-specs/

import machine
from machine import Pin, Timer
timer = Timer()

LED = Pin("WL_GPIO0", Pin.OUT)

def blink(timer):
    LED.toggle()
    
timer.init(freq = 1, mode = Timer.PERIODIC, callback = blink)

Share

EditDeleteFlag

edited 37 mins ago

answered 53 mins ago

tlfong01's user avatar

tlfong01

4,43433 gold badges99 silver badges2424 bronze badges

Add a comment

2

Your LED is wired to the GP13. So try Pin(13, Pin.OUT) instead of Pin("LED", Pin.OUT) 

Share

EditFollowFlag

answered yesterday

Mert Aksoy's user avatar

Mert Aksoy

12633 bronze badges

Add a comment

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.