Example Code for micro:bit-Mind+ LED Ring Compass

Last revision 2025/12/09

This article offers a step-by-step guide to creating an LED ring compass using micro:bit, including hardware and software preparations, wiring diagrams, and sample code for determining the North Pole based on geomagnetic fields.

Hardware Preparation

  • micro:bit × 1
  • IO Expansion Board × 1
  • RGB LED Ring- 24 LED beads × 1

Software Preparation

The extension library of the RGB LED command needs to be added before using the RGB LED ring. Open Mind+ platform, click "Extensions" in the bottom right corner, and in the "MCU" menu bar, select "micro:bit", the MCU to be used. Then find "WS2812 RGB LED" in the "Display" menu bar and click it to add the RGB LED extension library, then the display module will appear in the command area.

Wiring Diagram

Other Preparation Work

Open Mind+ platform, click "Extensions" in the bottom right corner, and in the "MCU" menu bar, select "micro:bit", the MCU to be used. Then find "WS2812 RGB LED" in the "Display" menu bar and click it to add the RGB LED extension library, then the display module will appear in the command area.

Sample Code

Result

Do a compass project using RGB LED ring with micro:bit to determine the North Pole based on the geomagnetic field.

Was this article helpful?

TOP