0% found this document useful (0 votes)
20 views3 pages

Document 1

The document contains an Arduino sketch for controlling traffic lights using digital pins. It sets up two sets of lights (red, yellow, green) and defines a loop for their operation, including delays for each light state. The program alternates between green, yellow, and red lights for two traffic signals.

Uploaded by

vir arkham Game
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Document 1

The document contains an Arduino sketch for controlling traffic lights using digital pins. It sets up two sets of lights (red, yellow, green) and defines a loop for their operation, including delays for each light state. The program alternates between green, yellow, and red lights for two traffic signals.

Uploaded by

vir arkham Game
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Int r1 = 1 ;

Int y1 = 2 ;

Int g1 = 3 ;

Int r2 = 4 ;

Int y2 = 5 ;

Int g2 = 6 ;

Void setup() {

pinMode (r1, OUTPUT) ;

pinMode (y1, OUTPUT) ;

pinMode (g1, OUTPUT) ;

pinMode (r2, OUTPUT) ;

pinMode (y2, OUTPUT) ;

pinMode (g2, OUTPUT) ;

Void loop() {

digitalWrite(g1, HIGH) ;

digitalWrite(r2, HIGH) ;

delay(9000) ;

digitalWrite(g1, LOW) ;

digitalWrite(y1, HIGH) ;

delay(1000) ;

digitalWrite(y1, LOW) ;

delay(1000) ;

digitalWrite(y1, HIGH) ;

delay(1000) ;

digitalWrite(y1, LOW) ;
delay(1000) ;

digitalWrite(y1, HIGH) ;

delay(1000) ;

digitalWrite(y1, LOW) ;

delay(1000) ;

digitalWrite(y1, HIGH) ;

delay(1000) ;

digitalWrite(y1, LOW) ;

delay(1000) ;

digitalWrite(g2,HIGH) ;

digitalWrite(r1,HIGH) ;

digitalWrite(r2,LOW) ;

delay(9000) ;

digitalWrite(g2,LOW) ;

digitalWrite(y2, HIGH) ;

delay(1000) ;

digitalWrite(y2, LOW) ;

delay(1000) ;

digitalWrite(y2, HIGH) ;

delay(1000) ;

digitalWrite(y2, LOW) ;

delay(1000) ;

digitalWrite(y2, HIGH) ;

delay(1000) ;

digitalWrite(y2, LOW) ;

delay(1000) ;

digitalWrite(y2, HIGH) ;

delay(1000) ;
digitalWrite(y2, LOW) ;

delay(1000) ;

digitalWrite(r2,LOW) ;

digitalWrite(r1,LOW) ;

You might also like