Microbit

We will put a BBC Micro:bit inside the box to light it up. This will give us control using code.

Controlling the LEDs

Our Algorithm

This is our algorithm for controlling the LEDs. An algorithm is a list of instructions that will achieve our goal. We write the algorithm in English.

When the Micro:bit program starts:
    Display your initials and a version number.
When Pin0:
    Turn ON all the LEDs.
When Pin1:
    Turn OFF all the LEDs.
Our Code - Part 1

In Purple Mash, go to Tools | 2Code | micro:bit | Free code mircro:bit

micro:bit code

We have successfully implemented our algorithm in code!

Extension

  • Try making a sound (hint: play music) when the light turns on and off. Just a few notes are all that are needed.
  • Can you make a sound for ON and a different one for OFF?