Project 29 · The Build Log

Your First Pico Project: A Reaction Game in MicroPython

Beginner ~1 hour ~$40 in parts, est.

Your First Pico Project: A Reaction Game in MicroPython

Disclosure: As an Amazon Associate I earn from qualifying purchases.

This first Pico project costs about $40, takes about an hour, and needs no experience: three LEDs, one button, and a short program that measures how fast you react. A light comes on at a random moment, you press the button, and the Pico prints your time in milliseconds.

Get the full kit → jumps to the parts list. New here? Read the starter-kit guide first. Good companions: the music-reactive LED strip (Project 04) and the plant monitor (Project 15), the next Pico step.

What a Pico Is — and What It Is Not

A Raspberry Pi Pico is a microcontroller: a tiny chip that runs one program, over and over, from the moment it gets power. No operating system, no desktop, no screen. Plug it in, it runs its program; unplug it, it stops. The Pico 2 W here costs about $6 to $8, has WiFi for later projects, and is programmed in MicroPython — real Python, trimmed to fit on a chip.

A full-size Pi is a computer; a Pico is a component. The Pi juggles many jobs; the Pico does one job, instantly, for pennies of electricity. That makes it the cheapest Start Here in this library: a sandwich-priced board, a handful of lights and a button, a USB cable, and a free editor. If the game clicks, the Pico family runs deep — sensors, motors, displays. If not, you spent an hour and $40 finding out.

What You’ll Need

Total: ~$40 in parts, est. (November 2026). You will also need a computer with a USB port and about an hour.

Step 1 — Set Up MicroPython and Thonny (20 Minutes)

First, give the Pico its language. MicroPython is Python made for microcontrollers, and it arrives as one firmware file from the MicroPython download page — choose the Pico 2 W build. Hold the white BOOTSEL button while you plug the USB cable in, then let go: the Pico appears as a USB drive. Drag the firmware file onto it. The drive vanishes, the Pico restarts, and MicroPython is installed.

Next, the editor. Thonny is a free Python editor made for beginners, from thonny.org, and it talks to the Pico directly. Install it, plug the Pico in (no BOOTSEL this time), and choose MicroPython (Raspberry Pi Pico) in the bottom-right corner. A >>> prompt should appear. Type print("hello") and press Enter — if “hello” comes back, the chain works: computer, cable, Pico, language.

Step 2 — Wire Three LEDs and a Button (20 Minutes)

Seat the Pico across the middle channel of the breadboard, USB port facing out. Every connection below is push-fit — a mistake is fixed by pulling a wire out and trying again. Work with the USB cable unplugged: wiring a live board is how pins get shorted.

Each LED has two legs: the long leg is positive, the short leg negative. Push the red LED’s long leg into a free hole, then connect a 220-ohm resistor from that row to the pin labelled GP13. Push the short leg into the ground rail, and run a jumper from the ground rail to any pin labelled GND. Repeat for yellow on GP14 and green on GP15 — long leg, resistor, GPIO pin; short leg, ground rail, GND. The resistor is not optional: without it the LED burns out, possibly taking the pin with it.

The button straddles the middle channel, one side wired to GP16, the other to the ground rail. That is the whole circuit. Before plugging in, check: every resistor sits between an LED and its pin, no bare wires touch, and the button straddles the channel. Plug in — nothing should light up yet. That silence is correct.

Step 3 — The Game Code (15 Minutes)

The game is one short program. Red means “wait”. After a random delay of one to three seconds, red goes out, green lights, and a timer starts. Press the button, the timer stops, and the Pico prints your time in milliseconds. Five rounds; best time wins. Type this into Thonny exactly as shown — comments starting with # are notes the Pico ignores:

# Reaction game: press the button when the green LED lights.
import time, random
from machine import Pin

red = Pin(13, Pin.OUT)
yellow = Pin(14, Pin.OUT)
green = Pin(15, Pin.OUT)
button = Pin(16, Pin.IN, Pin.PULL_UP)
best = None

for round_no in range(1, 6):
    # Wait... then light the green LED.
    red.on()
    time.sleep(random.uniform(1, 3))
    red.off()
    green.on()
    start = time.ticks_ms()
    while button.value() == 1:
        pass
    reaction = time.ticks_diff(time.ticks_ms(), start)
    green.off()
    yellow.on()
    print("Round", round_no, ":", reaction, "ms")
    if best is None or reaction < best:
        best = reaction
    time.sleep(1)
    yellow.off()

print("Best of 5:", best, "ms")

Three ideas carry the program. Pin.PULL_UP holds the button pin high until pressed, so the waiting loop watches for 1. The random delay is the game: a fixed delay can be memorised, and a memorised delay is not a reaction. And ticks_ms counts milliseconds since the Pico started, so the subtraction gives an honest reaction time — most people land between 200 and 300. Save it to the Pico as main.py and it runs on power-up, with no computer attached.

Step 4 — Play Five Rounds (5 Minutes)

Press Run and watch the board: red lights, an unpredictable pause, green lights, and you hit the button. Yellow flashes between rounds while the Pico prints your time. Play all five rounds, then read the best time. The first game is the slowest — you are watching code, board, and button at once. The second game is the real one.

Two honest quirks. Pressing early gives a silly 0 ms, because timing only starts at the green light — the honour system covers it for now, and a false-start check is your first upgrade below. And if nothing lights, check the LED legs: an LED wired backwards is the most common first-build fault, fixed by turning it around.

What to Try Next

Add a false-start rule. Check the button during the wait: pressed before green, print “Too soon!”, flash red, and replay the round. Five lines, and the honour system becomes a real game.

Build the two-player version. A second button on another pin lets two players race the same green light — the Pico knows who pressed first, down to the millisecond.

Add sound and a scoreboard. A buzzer beeps at the green light; a tiny display shows the best time with no computer attached, turning the game into a desk gadget.

What NOT to Buy

The Total, Honestly

Build It This Weekend

Flash MicroPython, wire three LEDs and a button, and run five rounds before lunch. If the green light makes you jump, you have built a game — and learned wiring, pins, timing, and a real program in one hour. Next week starts small: turn any old speaker into an AirPlay speaker.

Where the series goes next: the plant monitor (Project 15) is the next Pico build, and the full project library holds the rest.