Use a Two Colour LED Module with micro:bit

Make a Two Colour LED blink using the micro:bit

Written By: Cherie Tan

Dash icon
Steps icon


Want to make an LED light up and easily change their colours?

In this guide, we will learn to use a handy little LED module and make it blink using the micro:bit!

After completing this guide, you will understand how to use an LED and create a simple program using MakeCode. 

If you're using the Micro:bit Advent Calendar, you'll need the contents of the bags labelled 1 and 25.

Step 1   The Module

  • Before we begin, let's take a closer look at the Two Colour LED module! There are three pins:

    Signal: This pin is a signal pin, and can be used to emit a green light

    Middle Pin : This pin is another signal pin, and can be used to emit a red light

    GND: Though it is labelled '-' on the module, this is the ground pin also known as 'GND'. What is 'GND'? In electronics, we define a point in a circuit to be a kind of zero volts or 0V reference point, on which to base all other voltage measurements. This point is called ground or GND.

  • Voltage is the difference in electric potential between two points. As it is difficult to talk about voltage without a reference point, we need another point to compare it to. 
  • You might have noticed an 'R1' on the module, this stands for 'resistor'. However, the resistor here is actually a 0Ω resistor,  so we will need to use external resistors in the circuit!

Step 2   Connect module to breadboard

Step 3   Insert the Micro:bit into the Breakout board

  • Make sure that the micro:bit is inserted in the right orientation, with the buttons facing inward as shown.
  • Insert the micro:bit into the breakout board.

Step 4   Connect GND to -

Step 5   Add Resistor

Step 6   Add another Resistor

Step 7   Connect P0 to Resistor

Step 8   Connect P1 to Resistor

Step 9   Make the LED flash red

basic.forever(function () {
    pins.digitalWritePin(DigitalPin.P0, 1)
    pins.digitalWritePin(DigitalPin.P0, 0)
  • The first program we will create will make the LED module flash red. So open up the Makecode Editor.
  • Click on the Projects button
  • Create a new document
  • Copy and paste the Javascript code into the Javascript programming interface.
  • Click on the 'blocks' interface button and you should now see the MakeCode blocks.

Step 10   Upload the code to micro:bit

  • First off, click the download button in the bottom left corner of the screen. This will download a hex file (computer program file)  which the micro:bit can read.
  • Next, plug in your micro:bit, this will reveal a USB on your computer.
  • Lastly copy across the downloaded file to the micro:bit by dragging and dropping it into the MICRO:BIT drive
  • The micro:bit will flash as the code is being uploaded. Once done, unplug the micro:bit.
© 2022 Little Bird Electronics Pty Ltd.
Made with ❤️ in SYD. All prices inc GST. ABN 15 634 521 449. We're 🐥 @lbhq on Twitter.