Example Code for micro:bit-Light Up RGB LED

Last revision 2026/01/14

This guide provides step-by-step instructions on setting up and programming a micro:bit to light up an RGB LED using the MakeCode platform, including hardware and software preparation, a wiring diagram, and sample code.

Software Preparation

  1. Enter the MakeCode programming platform in browser: https://makecode.microbit.org/
  2. Create a new project and name it.
  3. Load in the program library of xia_mi board: click “setting”, and “expansion” in turn, then paste this link in the search box: https://github.com/DFRobot/pxt-DFRobot_xia_mi_Board.

Sample Code

MakeCode Program Link: https://makecode.microbit.org/_FJt7rr78WMKC

RGB LED color switching

Was this article helpful?

TOP