Raspberry Pi Pico LED Blink: Wiring, Code and Simulator

To build this Raspberry Pi Pico LED Blink project you need a Raspberry Pi Pico and a 220 Ω resistor and a red LED. CircuitPython digitalio blinks an LED on GP15 and the on-board LED. Make the 3 connections in the wiring table, upload the CircuitPython code, and compare with the MicroPython blink: same board, different Python and library names.

Open this circuit in the free Raspberry Pi Pico simulator

Parts list

QtyPartWhat it does
1Raspberry Pi Picothe microcontroller board
1220 Ω resistorLimits current. 220 Ω in series with an LED; 10 kΩ as a pull-up or pull-down.
1red LEDLights when A (anode, the bent leg) is high and C (cathode) is low. Use a resistor.

Wiring

#FromTo
1Raspberry Pi Pico GP15220 Ω resistor leg 1
2220 Ω resistor leg 2red LED anode (A, long leg)
3Raspberry Pi Pico GNDred LED cathode (C, short leg)

Step by step

  1. Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Raspberry Pi Pico. No install or account is needed.
  2. Add the parts. Add a 220 Ω resistor and a red LED from the parts palette.
  3. Wire 1. Connect Raspberry Pi Pico GP15 to 220 Ω resistor leg 1.
  4. Wire 2. Connect 220 Ω resistor leg 2 to red LED anode (A, long leg).
  5. Wire 3. Connect Raspberry Pi Pico GND to red LED cathode (C, short leg).
  6. Paste the CircuitPython code. Paste the CircuitPython code below into the code editor.
  7. Run it. Press Run. Compare with the MicroPython blink: same board, different Python and library names.

CircuitPython code

# CircuitPython blink: digitalio on GP15 and the on-board LED.
import board
import digitalio
import time

led = digitalio.DigitalInOut(board.GP15)
led.direction = digitalio.Direction.OUTPUT
onboard = digitalio.DigitalInOut(board.LED)
onboard.direction = digitalio.Direction.OUTPUT

while True:
    led.value = not led.value
    onboard.value = led.value
    print("LED is", "on" if led.value else "off")
    time.sleep(0.5)

What to try

Compare with the MicroPython blink: same board, different Python and library names.

Frequently asked questions

How do I wire the LED Blink project on a Raspberry Pi Pico?

Make 3 connections: Raspberry Pi Pico GP15 to 220 Ω resistor leg 1; 220 Ω resistor leg 2 to red LED anode (A, long leg); Raspberry Pi Pico GND to red LED cathode (C, short leg).

What parts do I need for this Raspberry Pi Pico project?

A Raspberry Pi Pico and a 220 Ω resistor and a red LED.

Can I simulate this Raspberry Pi Pico project online for free?

Yes. The BitForBytes Embedded Lab runs this exact circuit and CircuitPython code in your browser for free, with no install and no hardware. The RP2040 is emulated and runs the official firmware.

What does the code do?

CircuitPython digitalio blinks an LED on GP15 and the on-board LED.

More Raspberry Pi Pico projects