BBC micro:bit – Car Lighting System

car-indicatorsFor this challenge we will use the microbit and a couple of LEDs to act as the indicators lights of a car. Our aim is to use the built-in accelerometer sensor of the mincro:bit to detect if it is being tilted to the left or to the right. If so, the micro:bit will “turn the indicator” on by making one of the two yellow LEDs blink to indicate the player is turning to the left or to the right.

Electronic Circuit


First we need to build the electronic circuit using a micro:bit, two LEDs, a few wires and crocodile clips and a bread board.

car-indicators-electronic-circuit

micro:bit Code


Then we need to code the micro-bit to take control of the LEDs:
car-indicators-bbc-microbit-code

Extension Task


Add an extra red LED to act as the break light. Buttons A and B of the micro:bit will act as the accelerator pedal (Button A) and the break pedal (Button B). When button B is pressed the break light (red LED) should turn on.

Extra Challenge


car-siren

Using a red and a blue LED create an electronic circuit for the siren of a police car or a fire truck. Code your micro:bit to create the lighting sequence/pattern of your choice for your siren. You could also add a buzzer/speaker to create the sound of the siren. Use buttons A and B of the micro:bit to turn the siren on or off.

Share Button
Posted in BBC micro:bit, Computer Science Tagged with:

Our Latest Book

Follow this blog