Raspberry Pi Pico weather display (MicroPython)
Your first MicroPython project: temperature and humidity on an OLED.
Shop by category
Shop all componentsThe STM32F411 Discovery has four user LEDs in a ring (PD12-PD15), a blue user button (PA0) and an on-board ST-LINK programmer. With the STM32duino Arduino core you can program it from the Arduino IDE. The game shows a sequence of LEDs; you repeat it by pressing the button once for each step's LED position (short press steps through, long press confirms).
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
Mini-USB to the ST-LINK connector.
memory_game.inoVerify & upload in Electrolarkconst int LEDS[4] = {PD12, PD13, PD14, PD15};
int seq[32], len = 1;
void flash(int i, int ms) { digitalWrite(LEDS[i], HIGH); delay(ms); digitalWrite(LEDS[i], LOW); delay(150); }
int pick() { // short press = next LED, long press = choose
int cur = 0;
digitalWrite(LEDS[cur], HIGH);
while (true) {
while (digitalRead(PA0) == LOW) {}
unsigned long t = millis();
while (digitalRead(PA0) == HIGH) {}
if (millis() - t > 600) { digitalWrite(LEDS[cur], LOW); return cur; }
digitalWrite(LEDS[cur], LOW); cur = (cur + 1) % 4; digitalWrite(LEDS[cur], HIGH);
}
}
void setup() {
for (int i = 0; i < 4; i++) pinMode(LEDS[i], OUTPUT);
pinMode(PA0, INPUT);
randomSeed(analogRead(PA1));
for (int i = 0; i < 32; i++) seq[i] = random(4);
}
void loop() {
for (int i = 0; i < len; i++) flash(seq[i], 400);
for (int i = 0; i < len; i++) {
if (pick() != seq[i]) { // wrong: flash all and restart
for (int k = 0; k < 3; k++) { for (int j = 0; j < 4; j++) digitalWrite(LEDS[j], HIGH); delay(200);
for (int j = 0; j < 4; j++) digitalWrite(LEDS[j], LOW); delay(200); }
len = 1; return;
}
}
len = min(len + 1, 32);
delay(600);
}
Install STM32CubeProgrammer and choose the SWD upload method; update the ST-LINK firmware if asked.
Install the latest STM32duino core; the board is under the Discovery group.
PA0 reads HIGH when pressed on this board; the sketch expects that.
No, the ST-LINK is on the board.
Yes; the same pins are PD12-PD15 and PA0 in CubeMX.
A motion sensor and an audio DAC; see ST's user manual for the exact parts on your board revision.
1 part: STM32F411VE Discovery Dev Board w/ ST-LINK/V2. 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 4 steps.
About ₹2,589 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Using an STM32 board's on-board ST-LINK; STM32 pin names in the Arduino core; Short and long button presses.
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.