BBC microbit

Embedded microcontrollers – the BBC Micro:bit

A microcontroller is a small, programmable computer on a single integrated circuit. They are called embedded microcontrollers because they are usually embedded into a device in order to run a program to do a specific task. “A microcontroller takes input from the device it is controlling and controls the device by sending signals to different components in the device. ” (How Stuff Works).

Microcontrollers are found in thousands of everyday devices. For example, a microwave oven includes a controller that takes input from a keypad, displays output on an LCD display (such as the cooking time) and controls an electromechanical switch (a ‘relay’) that turns the microwave generator on or off.

There are many different types of microcontroller. Here are a few of them:

The BBC Micro:bit

The BBC Micro:bit is a microcontroller – a tiny programmable computer that was developed to help children learn the basics of programming in an easy, accessible way. It includes inbuilt sensors to register movement, light and temperature, and has a screen with a matrix of LEDs so that it can display letters, numbers and symbols. It even has a compass, and bluetooth connectivity. A small USB cable connects it to a computer, to make it easy to download programs onto the micro:bit.

Programming the micro:bit

The microbit can be programmed using MicroPython, Javascript or Blocks, which is a visual block-building version of Javascript. The blocks allow you to drag and drop programming instructions or conditions onto a workspace, then fine tune them by selecting attributes or variables.

Below is a screenshot of the initial code I created – it tells the microcontroller to do three things:

  1. Count upwards whenever button A (the left button) is pressed
  2. Count downwards when button B (the right button) is pressed
  3. Display a random number between 0 and 6 when the microbit is shaken (like a dice)

Here’s a brief demo of how the above code works:

References

Leave a Comment

Your email address will not be published. Required fields are marked *