A simple MicroPython project that blinks the onboard or external LED on the Raspberry Pi Pico W, created using Thonny IDE.
- Raspberry Pi Pico W
- MicroPython firmware flashed
- Thonny IDE (latest version)
- USB cable (Data-enabled)
- Open Thonny IDE
- Select interpreter:
Run β Select Interpreter β MicroPython (Raspberry Pi Pico)
- Connect your Pico W via USB
- Save the script as
main.pydirectly onto the Pico - Run it β the onboard LED should blink every 0.1 seconds β¨
machine.Pin("LED", machine.Pin.OUT)β Initializes the onboard LED pin.led.toggle()β Flips the LED state.time.sleep(0.1)β Adds a short delay (100 ms).
| Action | Change |
|---|---|
| Slow blink | time.sleep(0.5) |
| Fast blink | time.sleep(0.05) |
| External LED | Replace "LED" with GPIO number (e.g., 15) |
- Breathing LED using PWM brightness control
- Wi-Fi-controlled LED (use
networkmodule) - Blink pattern to indicate Wi-Fi connection status