Built-in project · STM32 Blue Pill (F103)

Blue Pill lamp

A lamp on a Blue Pill that blinks in step with the board’s own LED, because both hang off 3.3 V and PC13 sinks them. The whole build, an STM32 Blue Pill and 2 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.

StarterRuns in your browser. Free, and no account needed.

Blue Pill lamp · STM32 Blue Pill (F103)live0.000 s 0.00x
Click to open it in the editor
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

The code

The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.

sketch.ino · STM32 Blue Pill (F103)
// Blink: the smallest thing a board can do.
//
// The Blue Pill's green LED sits between the 3.3 V rail and PC13 through a
// 1 k resistor, so driving the pin LOW lights it and HIGH turns it off. That
// is the opposite of the Uno's, and it catches everybody once.
//
// Wire an LED and a 220 ohm resistor from PC13 to 3V3 to see the same thing on
// the breadboard.
//
// delay() parks the core on WFI between SysTick ticks rather than spinning, so
// this sketch costs the simulator almost nothing while it waits.

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);
}

void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // lit
  delay(500);
  digitalWrite(LED_BUILTIN, HIGH);  // dark
  delay(500);
}

Parts list

4 parts, plus the jumper wires. Every one is in the editor's parts bin.

How it is wired

3 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.

  • STM32 Blue Pill (F103) pin PC13; LED, green pin C
  • STM32 Blue Pill (F103) pin 3V3; Resistor, 220 Ω pin 1
  • Resistor, 220 Ω pin 2; LED, green pin A

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.