Go to the makecode.com website and create a new Microbit project.
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:
First let's test that all the lights work on your traffic lights. Add the following code and then send it to your Microbit.
After you have sent the code to your Microbit, test that each light works by pressing the A, B and A+B buttons. If any of the lights are flickering then make sure that the screws are tight.
Give your project a name and send it to your Microbit by following these steps:
We are going to program the traffic lights to show the lights in a sequence. In coding, a 'sequence' is the order in which instructions happen. For example if you were programming a robot to put on her shoe, the sequence would be:
For our traffic lights we are going to program them to go through this sequence:
Delete the code you have created already as we no longer need it.
There are two different ways we can display the lights on the traffic lights. The first way is just by setting each light to either on or off.
Add the following code to make the traffic lights forever go through the sequence. Once you've added the code, download and send it to your Microbit.
Check that the lights are displaying in the right sequence.