- Move Mini Robot Car
Move Mini Knight Rider
Knight Rider was a famous TV series with a car called KITT. In this project we'll recreate KITT's red scanning lights.
1 - Introduction
Knight Rider was a famous TV series in the 1980s that had a car called KITT (Knight Industries Two Thousand). KITT had distinctive red lights at the font of the car that would go back and forth.
In this project we'll recreate those scanning red lights on our Move Mini.
2 - Create a new Microbit project
3 - Add the neopixel extension
Your Move Mini has 5 LED lights at the front of it. To program these we will need the neopixel extension which has special blocks for programming LEDs.
Add the neopixel extension to your project.
To add an extension follow these steps:
- Click on 'Advanced' in the toolbox
- Click 'Extensions'
- Type the name of the extension in the search box
- Click on the extension in the search results
- The extension and all it's blocks will be added to your toolbox
4 - Create a variable for the LED strip
The 5 LEDs on your Move Mini are a 'LED strip' which just means a group of LEDs in a row. To work with them we need to create them into a variable which we can then use to program.
Add the following code to your project.
5 - Create a 'showRed' function
We will program one LED at a time to light up red, turn off and then wait a short amount of time before we light up the next LED.
As the code will be the same for each LED we will make a function so we don't have to repeat the same code five times.
Create a function called 'showRed' and give it a number parameter called led. This 'led' parameter will be the number of the LED you want to light up.
Functions are useful if you have some code/instructions that you want to use again and again.
To create a function go to the Advanced > Functions toolbox and click 'Make a Function'.
Give your function a name that makes sense and choose whether to pass anything into the function. In this example we will pass in a number.
This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.