Knight Rider was a famous TV series with a car called KITT. In this project we'll recreate KITT's red scanning lights.
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.
Go to the makecode.microbit.org website and create a new project.
Go to the Makecode.com Microbit website using the link below and click on the 'New Project' button underneath the 'My Projects' heading.
Install the micro:bit app on your iPad or tablet.
Open the app, tap 'Create code' and then create a new project.
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:
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.
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.