-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsemafaro_v1.ino
60 lines (53 loc) · 1.04 KB
/
semafaro_v1.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
void setup() {
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
pinMode(10, OUTPUT);
pinMode(9, OUTPUT);
}
void loop() {
toggleGreen();
toggleYellow();
toggleRed();
}
void toggleGreen() {
digitalWrite(11, HIGH);
digitalWrite(12, LOW);
digitalWrite(13, LOW);
togglePersonRed();
delay(5000);
}
void toggleYellow() {
digitalWrite(11, LOW);
digitalWrite(12, HIGH);
digitalWrite(13, LOW);
delay(3000);
}
void toggleRed() {
digitalWrite(11, LOW);
digitalWrite(12, LOW);
digitalWrite(13, HIGH);
togglePersonGreen();
delay(2000);
digitalWrite(9, LOW);
blinkPersonRed();
delay(500);
togglePersonRed();
}
void blinkPersonRed() {
for(int x=0; x < 5; x++){
digitalWrite(10, LOW);
delay(500);
digitalWrite(10, HIGH);
delay(500);
}
digitalWrite(10, LOW);
}
void togglePersonRed() {
digitalWrite(10, HIGH);
digitalWrite(9, LOW);
}
void togglePersonGreen() {
digitalWrite(10, LOW);
digitalWrite(9, HIGH);
}