Traffic Lights - the logic behind it

How do traffic lights work? I mean logically how do they work?
Well I had to figure it out with several of my friends as a part of a workshop.

Let's start with asking what's the point of a traffic light? So the point of a traffic light is the guide cars and other traffic and to prevent complete chaos on the streets.

A traffic light has three states which mean different things; red, yellow and green. Red to stop, yellow to prepare to stop and green to go.

Take a regular crossing where two perpendicular roads cross, and name them North/South and East/West.
Start with N/S at red.
E/W is at green and going.
Wait 30 seconds.
Switch E/W to yellow.
Wait 3 seconds.
Switch it to red.
Wait 3 seconds again.
Switch N/S to green.
Wait 30 seconds.
Switch it to yellow.
Wait 3 seconds.
Switch to red.
Wait 3 seconds.
Switch E/W to green.
Repeat.

It sounds unnecessarily long and complicated but computers need exact instructions to do their tasks.
A robot arm at a factory would need similar instructions; move arm forward 30cm, rotate by 45°, etc.

By the way, that set of instructions took us over an hour to come up with.
To learn programming we have to look at the simplest programs and take them apart into pieces, and so we did that.

(no images today I'm afraid :( my PC is put of commission and the mobile app doesn't have an option for it for some reason)

Comments

Popular posts from this blog

Introduction to a Future Revolutionary

Game Vision Statement

Prototype for my space game