Tutorial

Β 

Thonny + MicroPython β€” Pico/Pico W πŸš€

🧭 Why Thonny?

Thonny is a simple Python editor that just works. Plug in a Pico, click run, smile.

Goal: install Thonny β†’ flash MicroPython β†’ run β€œblink”. Tiny code, big vibe.

πŸ’» Install Thonny

  1. Download Thonny for your OS and install it.
  2. Open Thonny. If it asks about Python, choose the default.
⚠️ School computers might need IT to installβ€”ask early.

πŸ”Œ Flash MicroPython onto the Pico

  1. Unplug the Pico. Hold the BOOTSEL button.
  2. While holding, plug it in via USB β†’ a drive called RPI-RP2 appears.
  3. In Thonny: Tools β†’ Options β†’ Interpreter:
    • Interpreter: MicroPython (Raspberry Pi Pico)
    • Port: the one that appears when Pico is plugged
    • Click: Install or update MicroPython β†’ follow prompts
πŸ’‘ Pico W? Pick the Pico W firmware in the installer.

✨ First Script: Blink

Type this in Thonny:

from machine import Pin, Timer
led = Pin("LED", Pin.OUT)
timer = Timer()
def tick(t): led.toggle()
timer.init(freq=2, mode=Timer.PERIODIC, callback=tick)
  1. Click Run. Save to MicroPython device as main.py to auto-start.
  2. LED should blink. If not, try Pin(25, Pin.OUT) on some Pico boards.

🧯 Quick Fixes

  • No device? Try another USB cable (must be data) and port.
  • Can’t flash? Re-enter BOOTSEL mode and retry installer.
  • Wrong port? Thonny β†’ bottom-right status bar β†’ change Interpreter/Port.

πŸŽ‰ Next Moves

  • Read a button, beep a buzzer, fade an LED (PWM).
  • Pico W: connect Wi-Fi and print your IP.

Python + hardware = instant power. πŸ”₯