|
META TOPICPARENT |
name="TheUCCOpenDay" |
Traffic light simulator |
| Imagine a road crossing where you have traffic lights on both roads. When the traffic light is green on one road it must be red on the other. The traffic lights are in this state for some time to make a good number of cars pass the crossing. Then the green light turns to yellow while the light on the other road is still red. This is a short phase just allowing the cars, which are already on the crossing to clear it. Then we keep both lights on red for a short period as a safety phase, before switching the other traffic light to green, again for a longer period.
There are therefore the following phases: |
|
> > | |
| Traffic Light 1 | Traffic Light 2 | Period | green | red | long | yellow | red | short | red | red | short | red | green | long | red | yellow | short | red | red | short |
When running the program on the Raspberry Pi or on the Arduino, these phases can be observed. The whole program can be implement as a simple state machine. |
|
> > | ... and here you see the traffic light simulator in action:
 |
| -- Uli Raich - 2017-10-06
Comments
|
|
> > |
META FILEATTACHMENT |
attachment="trafficLight.png" attr="" comment="" date="1507551063" name="trafficLight.png" path="trafficLight.png" size="490146" user="uli" version="1" |
|