Built-in project · BBC micro:bit V2

micro:bit blink

A heart beating on the micro:bit's LED matrix, the board's own blink. The whole build, a BBC micro:bit, 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.

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

micro:bit blink · BBC micro:bit V2live0.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 · BBC micro:bit V2
// Blink: a heart beating on the LED matrix.
//
// The micro:bit has no single LED to blink, so this blinks all of them at
// once: a big heart, then a small one, twice a second. showLeds() takes the
// picture as five rows of five, # for a lit LED and . for a dark one; the
// spaces are only there so the rows look like the picture.
//
// Underneath, the runtime scans the matrix a row at a time from the SysTick
// interrupt, driving each row's pin high and the columns of its lit LEDs low,
// which is how the real board lights 25 LEDs from ten pins. delay() parks the
// core on WFI between ticks, so this sketch costs the simulator almost nothing.

void setup() {
}

void loop() {
  showLeds(". # . # ."
           "# # # # #"
           "# # # # #"
           ". # # # ."
           ". . # . .");
  delay(500);
  showLeds(". . . . ."
           ". # . # ."
           ". # # # ."
           ". . # . ."
           ". . . . .");
  delay(500);
}

Parts list

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

Change it and keep it

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