traffic lights

traffic lights

In this example, you ind out how to tune traffic lights on each other

Easy

30 mins

from 8 years on

1Introduction

Teaching objectives

  • Find out how to tune traffic lights on each other
  • On which the colors of the LED change
  • Programming waiting time adjustment

Material

  • Computer with Internet access
  • Calliope mini
  • Program traffic light red
  • Program stopwatch
  • Worksheets I and II for traffic lights
2Worksheet I

Surely you have already ridden your bike through the town and were annoyed that the traffic light turned red shortly before your arrival. Have you ever thought about how you can influence the traffic lights? Why do you actually have to program traffic lights?

Task: Program a traffic light

  1. A traffic light switches from green to yellow to red. It is important to make sure that each color is visible for a sufficiently long time. We simplify the traffic light so that only one colour appears at a time. You must now program your Calliope in such a way that it simulates a fully permanent traffic light switch. There are the following defaults: green should light up 10 seconds, yellow 2 seconds and red we shorten to 3 seconds.
    Write down how a traffic light switches from red to red again:
    Now write down with time specifications how the traffic light would run through a complete cycle in this example:

  2. Now you should program a traffic light independently. To make your work easier, here is the beginning. It is made available to you below as a program "traffic light red".

  3. Save it after successful simulation under the name "traffic light".

3Worksheet II

Eureka! You have now programmed your first traffic light. But now you surely have to find someone with whom you can solve the problem together. It made sense to work in groups of three or four. We want to make sure that we get from one traffic light to the next and switch it to "green" exactly when we are close to it. But how do we do that?

  1. The best place to work is on the school corridor. The first traffic light is at one end of the corridor, the other at a corridor door that you open and then have to go through. To solve the problem, you should save and use the Stopwatch program on a Calliope mini. Together with your partners, think about how to proceed and write down your thoughts.
    Note: The beginning of your program consists of the program "traffic light". You have to change it so that the "green" traffic light goes out after 100ms.

  2. Complete your program now. Save it under the name "Traffic light" and save it to a calliope mini. Try it out and modify it until your traffic light works. The task is completed when you can go at "green" and can open the door at "green" without having to wait. You also have to come through the door during the green phase.

  3. Now you have programmed the traffic light to suit you. But now cyclists and cars also drive on the way. Think together which problems there could occur.

  4. Additional task: Consider a traffic light phase attentively at the road. What distinguishes this traffic light from yours?

This text as well as the image is published under a CC BY-NC 4.0 DE license popup: yes. It was originally published in German popup: yes by infgsnds popup: yes and translated into English by the Calliope team.

YOU CAN FIND THE FINISHED FILES BELOW.

The HEX-File can be used on your Calliope mini directly. The XML-File can be opened with the OpenRoberta editor.

hex xml