Start here
This section is a course in MicroPython on a Raspberry Pi Pico: a real MicroPython interpreter driving a simulated board, in your browser. You do not install anything.
There are two places to build on a Pico:
- The Sandbox —
circuit.pydescribes the parts and the wires,main.pyis the program. Choose New… → Raspberry Pi Pico (MicroPython) in the Sandbox's toolbar to start from a Pico. - Lab mode — drag a Pico from the Boards group onto the canvas and wire parts by hand.
The Raspberry Pi Pico (MicroPython) explains how the Pico differs from a Pi in both places.
The one-minute tour (Sandbox)
- circuit.py describes the parts and the wires. It is code, not drag-and-drop: what you write is what appears on the board. The Shop tab inserts a part's line for you.
- main.py is the program the Pico runs.
- The board is on the right. It is live while a program runs: pins light up, wires carry current, the LED glows and the OLED shows what you draw. The console under it shows what your program prints.
- Run powers the board and starts
main.py; while it runs, the same button says Stop.
Fun fact. The Pico is smaller than a stick of gum and has two processor cores. The model on your screen is about 1.3 MB of real firmware — the same MicroPython that runs on the plastic board.
Your first program
- In the Sandbox, choose New… → Raspberry Pi Pico (MicroPython). Replace
circuit.pywith:from wiring import * pico = Pico() pico.GP13 >> Resistor(330) >> LED("red") >> pico.GNDRead the chain before you run anything: GP13 → 330 Ω → the LED → ground.
- Replace
main.pywith:from machine import Pin import utime led = Pin(13, Pin.OUT) while True: led.on() utime.sleep(0.5) led.off() utime.sleep(0.5) - Press Run. The LED blinks once a second. The console shows only the MicroPython banner, because nothing is printed.
- Press Stop, then change
0.5to0.1and run again. Predict what happens before you press Run. (It blinks five times a second, too fast to look like a clean blink.)
>> means “connect to”. You can add parts to the circuit the same way.
Careful. The circuit is the source of truth, not the picture. If a part disappears when you press Run, look at
circuit.py: the code builds the board again from scratch each run.
Your first print
print writes to the console — the dark panel under the board. It is the cheapest debugging tool you have:
from machine import Pin
import utime
button = Pin(12, Pin.IN, Pin.PULL_DOWN)
while True:
print("button", button.value())
utime.sleep_ms(250)
The console shows a new line four times a second. When something is not working, print the numbers you think are true and compare.
The five rules of the bench
- 3.3 V logic. A GPIO is not 5 V tolerant. 5 V on a pin damages it for the rest of the run.
- Every circuit needs a ground. A wire that ends nowhere does nothing.
- An LED needs a resistor. 220–330 Ω is right on this board.
- Every
while Trueloop needs a sleep. A loop with no sleep never gives the rest of the board a turn. - GP25 is the on-board LED, not a header pin. GP23 and GP24 are not on the header either.
When it does not work
| What you see | What to check |
|---|---|
| Nothing happens when you press Run | Is the program stuck before your first output? Add a print at the top |
NameError | A missing import, or a typo in a name. Pin comes from machine |
SyntaxError | Look at the line number; check : at the end of if/while/for, and == versus = |
| The board says a pin is damaged | 5 V or too much current reached it. Undo the wire, then press Run again |
| A test fails but the board looks right | Read the check's detail: it may be watching a different time window, pin or part |
| The console is empty | print only shows what you actually print; the board does not narrate itself |
If you are stuck for more than ten minutes, write down three things: what you expected, what happened, and the smallest change you tried. That note is usually enough to find the bug.
Where to go next
- The course — the full path, module by module, with what you will be able to do and which problems to try.
- Lesson 1: Switch a pin — start the foundations.
- Ten things to build — complete projects, from a traffic light to a parking sensor, once you have done the first lessons.
- Word bank — every term in plain language.
- The pinout and the machine reference — when you need an exact pin or API.
- What this Pico can and cannot do — the honest limits before you design.
A last thought. Programming is mostly reading: reading the problem, reading the error, reading what the board actually did. The typing is the small part. Be patient with the reading and the rest gets faster.