Design an interface showing the street traffic signal programmed to keep red light for 30 secs and green light for 60 secs.
Last Updated : 16 Jul 2025
Solution:
void setup(){
pinMode(10, OUTPUT); // RED LED = pin 10
pinMode(11, OUTPUT); // GREEN LED = pin 11
}
void loop(){
digitalWrite(10, HIGH); // Turn on the RED LED
delay(30000); // Wait for 30 seconds
digitalWrite(10, LOW); // Turn off the RED LED
digitalWrite(11, HIGH); // Turn on the GREEN LED
delay(60000); // Wait for 60 seconds
digitalWrite(11, LOW); // Turn off the GREEN LED
}
Report an error
Meanwhile you can watch this video
Watch Video