How to blink Raspberry Pi Pico onboard LED?
27 Jan 2024Original documentation for Raspberry Pi documentation shows turning on LED this code.
from machine import Pin, Timer
led = Pin(25, Pin.OUT)
timer = Timer()
def blink(timer):
led.toggle()
timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)
Above code doesn’t work. It should be changed to this.
from machine import Pin, Timer
led = machine.Pin("LED", machine.Pin.OUT)
timer = Timer()
def blink(timer):
led.toggle()
timer.init(freq=2.5, mode=Timer.PERIODIC, callback=blink)
Reference
Tags
- Pico
- Raspberry Pi
- LED