Exercise 2: Traffic signal switching


The first sensor is presented in this model: a push button. Students learn about the structural element „condition“ in Scratch and program a  demand-controlled switch. You will also learn how to create sounds with Scratch.


What is a „digital sensor“? What is a condition? How does a push button work? How do you program a traffic light controller?



Learning objective

  • Understanding a push-button as a “digital sensor”
  • Condition as a structural element of a programming language
  • Programming of a demand-dependent time control (traffic light switching)

Time required

Setting up and wiring the traffic lights takes about half an hour of class time.

The „pedestrian traffic light“ task is based on model 1 and requires half a lesson. The „traffic lights on demand“ tasks require up to one lesson depending on previous experience.

The „Traffic lights for the blind“ task can be used as an additional task for students with particularly quick comprehension skills or experience with Scratch. Its completion is not a prerequisite for subsequent tasks.