Did you know?
An embedded system is a computer system with a dedicated function within a larger mechanical or electrical system, often with real-time computing constraints.
A burglar alarm, an in-car cruise control system, a speedometer on a bike, a traffic lights control system are all examples of embedded system.
One application of computing is to create the algorithms used by these control systems. For this challenge we will focus on a traffic lights system.
Our Traffic Lights
Our system consists of two traffic lights used at a crossing.
The diagram below describes the sequence that these traffic lights have to follow:
We have started the code to control the first traffic light.
Your Challenge
Tweak this code to control the second traffic light. The second traffic light sequence should match the one described in the diagram above. However both traffic lights cannot be green at the same time!
Extension
Check this article to see how “smart” traffic lights help control the flow of traffic more effectively.