Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsA proto shield sits on top of the Uno and gives you a small breadboard right above the board, so a circuit stays together and can be carried around. This classic first project uses five LEDs, a button and a buzzer to make a crossing: cars on green until someone presses, then amber, red, a beeping walk signal and back. It teaches timing with a state machine instead of long delays.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB from a PC or a 5 V charger.
crossing.inoVerify & upload in Electrolarkconst int CR = 4, CA = 5, CG = 6, WR = 7, WG = 8, BTN = 2, BUZ = 9;
enum { CARS_GO, AMBER, WALK, FLASH } state = CARS_GO;
unsigned long since = 0;
bool waiting = false;
void lights(bool r, bool a, bool g, bool wr, bool wg) {
digitalWrite(CR, r); digitalWrite(CA, a); digitalWrite(CG, g); digitalWrite(WR, wr); digitalWrite(WG, wg);
}
void setup() {
for (int p = 4; p <= 9; p++) pinMode(p, OUTPUT);
pinMode(BTN, INPUT_PULLUP);
lights(0, 0, 1, 1, 0);
}
void loop() {
unsigned long t = millis() - since;
if (digitalRead(BTN) == LOW) waiting = true;
switch (state) {
case CARS_GO:
if (waiting && t > 5000) { state = AMBER; since = millis(); lights(0, 1, 0, 1, 0); }
break;
case AMBER:
if (t > 3000) { state = WALK; since = millis(); lights(1, 0, 0, 0, 1); waiting = false; }
break;
case WALK:
if ((t / 250) % 2 == 0) tone(BUZ, 2000); else noTone(BUZ);
if (t > 8000) { state = FLASH; since = millis(); noTone(BUZ); }
break;
case FLASH:
digitalWrite(WG, (t / 300) % 2);
if (t > 3000) { state = CARS_GO; since = millis(); lights(0, 0, 1, 1, 0); }
break;
}
}
It is the wrong way round: the long leg goes to the resistor and pin.
It must bridge D2 and GND across the breadboard gap; turn it 90 degrees.
Yours is an active buzzer; replace tone()/noTone() with digitalWrite HIGH/LOW.
With delay() the Uno cannot see the button while waiting; millis() keeps it responsive.
Yes, the shield also has a solder area for a permanent version.
Yes, the header layout is the same.
6 parts: Uno R3 CH340G ATmega328p Compatible Development Board, UNO Proto Shield with SYB-170 Mini Breadboard, 5 × 5mm LED by Colour (Pack of 10), Resistor Assortment Kit (30 Values), Tactile Push Button Switch and Buzzer Module 3.3–5V. 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 1 hour. The build on this page has 5 steps.
No. This page has the complete, tested code (crossing.ino).
About ₹423 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Using a proto shield and mini breadboard; LED current-limiting resistors; A state machine with millis().
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.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.