Traffic lights all around Ireland run on code — a computer inside the box tells the lights exactly which colour to show and for how long, in the same order every time. That order is called a sequence, and getting it right keeps cars and people safe. Today you become the programmer: you'll build your own set of traffic lights in Scratch, block by block. Watch the board first as we model each piece, then build it on your device and run it to see what your code does.
Set the scene: tell pupils they are programming traffic lights and will build it in stages. Model on the IWB first, then let pairs work. Key question: 'What has to happen first before anything else?' Reassure pupils that mistakes are normal and part of coding — we fix them as we go.
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!
Read this together and link the idea of a sequence to something familiar like their morning routine. Ask: 'What would go wrong if we did the steps in the wrong order?' This anchors the meaning of sequence before any blocks appear on screen.
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.
Have pupils click the starter link and confirm they can see the traffic light sprite. The common snag here is pupils opening a blank project — circulate and check every pair has the sprite with its three costumes before moving on.
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
Model adding the first two blocks on the IWB, then have pairs copy. Ask them to click the green flag and confirm the light turns red and holds. Watch for the wait block being left off, which makes red flash by. Support: build this one step with them and celebrate it working before continuing.
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
Model placing the new blocks underneath the red ones — stress that order matters. Key question: 'Which colour should show after red?' Common bug: blocks snapped in the wrong order so green shows first; fix by dragging to reorder. Have pairs run it and watch the full red-then-green sequence.
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.