Microbit
Beginner
30 mins
Teacher/Student led
+100 XP
What you need:
Chromebook/Laptop/PC
Microbit
Traffic Lights Kit

Microbit Traffic Lights

In this lesson we program our traffic lights to go through a sequence.

Teacher Class Feed

Load previous activity

    1 - Create a new Microbit project

    Go to the makecode.com website and create a new Microbit project.

    2 - Add the Stopbit extension

    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.



    3 - Test all the lights

    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.

    4 - What is a sequence?

    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:

    1. put on her sock
    2. put on her shoe
    3. tie her laces

    For our traffic lights we are going to program them to go through this sequence:

    1. show green light for 5 seconds
    2. show yellow light for 1 seconds
    3. show red light for 2 seconds
    123learn · Online learning platform

    Unlock the full learning experience

    You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.

    Hundreds of curriculum-aligned lessons
    Interactive activities in every lesson
    Printable resources & progress tracking
    Copyright Notice
    This lesson is copyright of Coding Ireland 2017 - 2026. Unauthorised use, copying or distribution is not allowed.
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more