Task - 3 Traffic Lights Controller
Task - 3 Traffic Lights Controller
The following gives the circuit diagram followed by the code and explanation to
build a traffic signal with three LEDs such that the signal remains red if a
pedestrian is crossing the road.
CIRCUIT DIAGRAM FOR THE TASK
The IR sensor senses whether a pedestrian is crossing or not and gives the corresponding
output to the input pin A0. This pin now gives a high signal for keeping the red light glowing
if the pedestrian is crossing the road and vice-versa.
}
Void loop()
{
digitalWrite(greenled, HIGH); /* turns the green LED on*/
delay(60000);
than 512 and gives a HIGH signal to the red LED so that it remains glowing till
the value becomes lower than 512( implying that the pedestrian has crossed the
road). Other LEDs keep glowing at an interval of 60 seconds(using the delay
command) one after the other.