Built-in project · Raspberry Pi Pico

CircuitPython blink on a Pico

CircuitPython on a Raspberry Pi Pico: digitalio blinks the board’s own LED and a red LED on GP15, once a second, and print() says on and off. The whole build, a Raspberry Pi Pico and 2 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.

Teaching? Assign it to your class in one click.

Beginner Runs in your browser. Free, and no account needed.

The parts retail for about $4.15. On Mokxi they're free.

CircuitPython blink on a Pico · Raspberry Pi Picolive0.000 s 0.00x
Click to open it in the editor
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

The code

The MicroPython code exactly as the editor opens it. Change a line there and press Run: the board runs it on the official MicroPython firmware, with nothing to compile.

code.py · Raspberry Pi Pico
# CircuitPython on a Raspberry Pi Pico: blink an LED.
# board.LED is the Pico's own LED (GP25); the red LED on GP15 through
# 220 ohms blinks with it.
import board
import digitalio
import time

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

while True:
    onboard.value = led.value = True
    print("on")
    time.sleep(0.5)
    onboard.value = led.value = False
    print("off")
    time.sleep(0.5)

Parts list

3 parts, plus the jumper wires. They retail for about $4.15; on Mokxi they're free.

How it is wired

3 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.

  • Ground: Raspberry Pi Pico pin GND; LED, red pin C
  • Raspberry Pi Pico pin GP15; Resistor, 220 Ω pin 1
  • Resistor, 220 Ω pin 2; LED, red pin A

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.