-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTraffic_Light_Code.ino
39 lines (39 loc) · 1.33 KB
/
Traffic_Light_Code.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
int ledred1 = 13;
int ledyellow1 = 12;
int ledgreen1 = 11;
int ledred2 = 7;
int ledyellow2 = 6;
int ledgreen2 = 5;
int crosswalk = 2;
void setup()
{
pinMode(ledred1, OUTPUT);
pinMode(ledyellow1, OUTPUT);
pinMode(ledgreen1, OUTPUT);
pinMode(ledred2, OUTPUT);
pinMode(ledyellow2, OUTPUT);
pinMode(ledgreen2, OUTPUT);
pinMode(crosswalk, OUTPUT);
}
void loop()
{
digitalWrite(7, HIGH);
digitalWrite(11, HIGH);
delay(1500); // Wait for 1000 millisecond(s) digitalWrite(11, LOW);
delay(1000); // Wait for 1000 millisecond(s) digitalWrite(12, HIGH);
delay(1000); // Wait for 1000 millisecond(s) digitalWrite(12, LOW);
delay(1000); // Wait for 1000 millisecond(s) digitalWrite(13, HIGH);
delay(1500); // Wait for 1000 millisecond(s) digitalWrite(13, LOW);
delay(0000); // Wait for 1000 millisecond(s) digitalWrite(7, LOW);
digitalWrite(13, HIGH);
digitalWrite(5, HIGH);
delay(1500); // Wait for 1000 millisecond(s) digitalWrite(5, LOW);
delay(1000); // Wait for 1000 millisecond(s) digitalWrite(6, HIGH);
delay(1000); // Wait for 1000 millisecond(s) digitalWrite(6, LOW);
delay(1000); // Wait for 1000 millisecond(s) digitalWrite(7, HIGH);
digitalWrite(2, HIGH);
delay(30000);
digitalWrite(2, LOW);
digitalWrite(7, LOW);
delay(0000); // Wait for 1000 millisecond(s) digitalWrite(13, LOW);
}