← Back to Course
Installing MicroPython on Pico W + First Code
🛠️ Installing MicroPython on Pico W
📋 Step-by-Step Installation:
Step 1: Download MicroPython Firmware
Go to micropython.org/download/rp2-pico-w/
Download the latest .uf2 file for Pico W
Step 2: Put Pico W in Boot Mode
Press and hold BOOTSEL button → Connect USB cable → Release BOOTSEL
Pico W appears as "RPI-RP2" drive
Step 3: Install Firmware
Drag and drop the .uf2 file to "RPI-RP2" drive
Pico W restarts automatically with MicroPython installed
Step 4: Install Thonny IDE
Download from thonny.org
Select: Tools → Options → Interpreter → MicroPython (Raspberry Pi Pico)
📖 First MicroPython Code - Blink LED:
# Raspberry Pi Pico W Blink LED
# Built-in LED is on GP25 (WiFi LED) or add external LED to GP0
from machine import Pin
import time
# Use built-in LED (GP25) or external LED on GP0
led = Pin(25, Pin.OUT) # GP25 = built-in LED
while True:
led.value(1) # Turn LED ON
print("LED ON")
time.sleep(1)
led.value(0) # Turn LED OFF
print("LED OFF")
time.sleep(1)
📖 Reading Button Input:
from machine import Pin
import time
button = Pin(0, Pin.IN, Pin.PULL_UP) # Button on GP0
led = Pin(25, Pin.OUT)
while True:
if button.value() == 0: # Button pressed (LOW)
led.value(1)
print("Button pressed! LED ON")
else:
led.value(0)
time.sleep(0.05)
✅ Success!
Your Pico W is ready for IoT projects! MicroPython makes programming simple and powerful.
💡 Key Takeaways:
- Apply these concepts directly to your farm or project.
- Take notes on important details for the quiz.
- Use the button below to track your progress.
×