Scratch
Beginner
40 mins
Teacher/Student led
90 points
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Traffic Light Sequence

This lesson guides students through creating a traffic light sequence in Scratch. They will learn to create a new project, upload a sprite, understand sequencing, and program the traffic lights to change colours in a specific order.
Learning Goals Learning Outcomes Teacher Notes Lesson Files

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Introduction

    Welcome to our exciting project! Today, we are going to program a set of traffic lights to display the lights in the right order. But before we start, let's talk about what a sequence is.

    A sequence is like a list of instructions that we follow in a specific order. Just like when we get ready for school, we first brush our teeth, then we get dressed, and finally, we have breakfast. In coding, a sequence is a set of instructions that a computer follows one after the other.

    In our project, we will create a sequence for our traffic lights to change from red, to green, and then to orange. Are you ready to start? Let's go!


    2 - Open Starter Project

    In this lesson we are going to program a set of traffic lights to display the lights in the right order.

    Click on the link below to open a starter project that already has a traffic light sprite added to it.

    Open Starter Project


    3 - Set it to red

    The traffic lights sprite has 3 costumes, a red costume, an orange costume and a green costume.

    Let's program the traffic light to show the red light for 5 seconds. Add the following code to the traffic light sprite.

    when green flag clicked switch costume to (red v) wait (5) seconds

    Once you've added the code, click on the green flag and your traffic light you show the red light.

    4 - Set it to green

    Now let's program the traffic light to show the green light for 10 seconds after the red light is finished. Add the following code blocks to the traffic light sprite.

    when green flag clicked switch costume to (red v) wait (5) seconds // add them under here switch costume to (green v) wait (10) seconds

    Now click on the green flag again and the traffic light should:
    1. show the red light for 5 seconds
    2. then show the green light for 10 seconds

    5 - Set it to orange

    Now let's program the traffic light to show the orange light for 3 seconds after the green light is finished. Add the following code blocks to the traffic light sprite.

    when green flag clicked switch costume to (red v) wait (5) seconds switch costume to (green v) wait (10) seconds // add them under here switch costume to (orange v) wait (3) seconds

    Now click on the green flag again and the traffic light should:
    1. show the red light for 5 seconds
    2. then show the green light for 10 seconds
    3. then show the orange light for 3 seconds

    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.

    Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more