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

BBC micro:bit Code


Then we need to code the micro-bit to take control of the LEDs. You will need to use the micro:bit website to create the code using the JavaScript Block Editor.

micro-bit-logo

car-lighting-system-bbc-microbit-javascript-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.

Did you like this challenge?

Click on a star to rate it!

Average rating 3.1 / 5. Vote count: 7

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: