In this game one LED in the middle of your strip will light up yellow and another will light up blue and go back and forth along the length of the LED strip. The aim of the game is to press the A button when the moving blue LED passes over the yellow LED in the middle.
Each time you get it right the moving blue light will go a bit faster making the game more challenging.
If you press the A button when the moving blue light is not over the yellow LED then it's game over!
To get started create a new Microbit 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.
To access the blocks we need to program the LED strip, you need to add the neopixel extension to your project.
To add an extension follow these steps:
To be able to interact and program the LED strip we will need a variable that stores the strip.
Add the following code to your project. We set the value to be 30 as there are 30 LEDs on the strip.
We will need 4 variables to store different values in this project. Create the following 4 new variables:
Set the variables to the following values in the on start block:
In the Variables toolbox, create a new variable by clicking the 'Make a Variable' button.
Once you click this button a box will appear asking what you want to call your variable. Give it a name that reminds you what you will be using it for. For example, if you wanted to keep track of your score in a game, you would create a variable called 'score'.