Lesson 2

What is a micro:bit?

The micro:bit is a handheld, fully programmable microcontroller with a lot of built-in features.


  • 25 red LED (light emitting diodes) that can flash shapes, numbers and messages. The LED form a 5 x 5 grid that can be set to turn on or off and the brightness can be controlled.


  • Buttons A & B are a form of input. They can detect when either of the buttons are being pressed and released.


  • An accelerometer on the micro:bit can detect changes in the micro:bit's speed by converting analogue information into digital form. The micro:bit can also detect a few standard actions e.g. shake, tilt and free-fall. A compass on the micro:bit detects magnetic fields such as the Earth's magnetic field. As such, it is possible to detect the direction it is facing or moving in degrees.


  • A low energy Bluetooth connection that can be used to interact with other Bluetooth enabled devices and the Internet.

Block-Based Programming Environment

Using Google Chrome, key in the following website, https://makecode.microbit.org/

Task 1

  • In the programming environment, create the following codes in the programming area.
  • Look at the view results area and see if it displays a square.
  • Save your file as L2T1_<your name>.
  • Plug in your micro:bit into your laptop.
  • Download the hex file and move or copy the file to your MICROBIT drive.
  • You should be able to see the square on your micro:bit's LED.

Task 2

  • Create the following codes and download the hex file to your micro:bit.

Task 3

  • Create the following codes and download the hex file to your micro:bit.