The Riddler
The Riddler

Reputation: 26

LED fails to blink

When I run my code to blink a LED, Thonny runs it well. But on the Raspberry Pi Pico itself the LED is not blinking:

from machine import Pin
from time import sleep

led = Pin(25, Pin.OUT)

while True:
    led.toggle()
    sleep(0.1)

I tried resetting the whole board.

Upvotes: 0

Views: 145

Answers (1)

brainelectronics
brainelectronics

Reputation: 95

Just in case you run this code on a Raspberry Pi Pico W (with the WiFi module) you need to use

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

See MicroPython Forum Blink onboard LED

Upvotes: 1

Related Questions