Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsThe Pico adds a random colour to a list every round and plays the whole list back. You press the matching buttons; one mistake ends the game and the score appears in the shell. A great first game that teaches lists and loops.
Tick anything you already have and the total updates.
Red indicator LED for the alert state.; Green indicator LED for the normal state.; Yellow indicator LED.
Follow the colours: red is power, dark grey is ground, blue is a signal.
main.py# Pico Simon says memory game: three LEDs, three buttons, a buzzer (MicroPython)
from machine import Pin, PWM
import time, random
leds = [Pin(10, Pin.OUT), Pin(11, Pin.OUT), Pin(12, Pin.OUT)]
buttons = [Pin(6, Pin.IN, Pin.PULL_UP), Pin(7, Pin.IN, Pin.PULL_UP), Pin(8, Pin.IN, Pin.PULL_UP)]
speaker = PWM(Pin(15))
TONES = [330, 440, 550]
def show(i, ms=400):
leds[i].value(1)
speaker.freq(TONES[i]); speaker.duty_u16(20000)
time.sleep_ms(ms)
leds[i].value(0)
speaker.duty_u16(0)
time.sleep_ms(150)
def wait_press():
while True:
for i, b in enumerate(buttons):
if b.value() == 0:
show(i, 200)
while b.value() == 0:
time.sleep_ms(10)
return i
time.sleep_ms(5)
while True:
sequence = []
time.sleep(1)
while True:
sequence.append(random.randint(0, 2))
for s in sequence:
show(s)
ok = True
for s in sequence:
if wait_press() != s:
ok = False
break
if not ok:
for _ in range(3):
for l in leds:
l.value(1)
time.sleep_ms(200)
for l in leds:
l.value(0)
time.sleep_ms(200)
print("Game over, score", len(sequence) - 1)
break
time.sleep_ms(600)
LED is reversed; flip it. Check the 220 Ω resistor is in series.
The button is rotated 90°; legs on the same side are already connected. Turn it.
Normal for a bare piezo; mount it on a small box to resonate.
7 parts: 3 × Through-Hole LED Pack (Pack of 10), Tactile Push Button Switch, Piezo Buzzer (passive), Resistor Assortment Kit (30 Values), Raspberry Pi Pico, Solderless Breadboard (830 points) and Dupont Jumper Wires (40 pcs). Tools: Digital Multimeter and Wire Stripper and Cutter. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 45 minutes. The build on this page has 4 steps.
No. This page has the complete, tested code (main.py).
About ₹565 for the parts at the prices on this page, plus tools if you do not have them. Quantity price breaks lower the cost when you build several.
Current-limiting resistors for LEDs; Generating musical notes with tone(); Pull-ups and debouncing.
Ideas that reuse this build: Pico reaction game and Pico dice on OLED. They are listed under Take it further on this page.
Your first MicroPython project: temperature and humidity on an OLED.
A web page with ON and OFF buttons that switches a relay over Wi-Fi.
A warm ring light that fades up at dusk and down at dawn.
Turn a Pi and a touchscreen into a home command centre with a clock and to-do list.
Learning project. Check every circuit and the datasheet of each part before you power it up.