Make your Traffic Lights put on a lights show!
We're going to put on a lights show using your Microbit and your Traffic Lights Kit so you'll need to connect your Microbit to your Traffic Lights.
Take a look at the "Build your Traffic Lights" lesson if you need instructions.
There are custom code blocks that we use to program our traffic lights kit. To add them to our toolbox we need to add the "stopbit" extension.
Search for the "stopbit" extension and then click on the traffic lights kit picture.
This will add the "Kitronik STOP:bit" category of code blocks to your toolbox.
To add an extension follow these steps:
We're going to program the A button on our Microbit to make the traffic lights turn on and off the lights in a sequence. The sequence will be:
We also need to put in a little pause after each step, otherwise it will happen to fast and we won't see the lights effect we are creating! Add the following code.
At the moment pressing the A button will just run through the sequence once. So let's put the sequence inside a loop block so that it repeats the sequence 10 times.
Once you have added in the 'repeat' block, download your code to your computer and send it to your Microbit. Press the A button and test that it shows the lights sequence 10 times. If it doesn't, check your code to see if you have missed anything.