-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAmpelschaltung Kreuzung
63 lines (57 loc) · 1.11 KB
/
Ampelschaltung Kreuzung
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
61
62
63
const int rot1 = 5;
const int gelb1 = 6;
const int grun1 = 7;
const int rot2 = 2;
const int gelb2 = 3;
const int grun2 = 4;
void setup()
{
pinMode(rot1, OUTPUT);
pinMode(gelb1, OUTPUT);
pinMode(grun1, OUTPUT);
pinMode(rot2, OUTPUT);
pinMode(gelb2, OUTPUT);
pinMode(grun2, OUTPUT);
}
void loop()
{
digitalWrite(rot2, HIGH);
schaltung1();
delay(5000);
schaltung2();
delay(5000);
}
void schaltung1() {
digitalWrite(rot1, HIGH);
delay(1000);
digitalWrite(gelb1, HIGH);
delay(1000);
digitalWrite(rot1, LOW);
delay(10);
digitalWrite(gelb1, LOW);
delay(100);
digitalWrite(grun1, HIGH);
delay(5000);
digitalWrite(grun1, LOW);
digitalWrite(gelb1, HIGH);
delay(1000);
digitalWrite(gelb1, LOW);
digitalWrite(rot1, HIGH);
}
void schaltung2(){
digitalWrite(rot2, HIGH);
delay(1000);
digitalWrite(gelb2, HIGH);
delay(1000);
digitalWrite(rot2, LOW);
delay(10);
digitalWrite(gelb2, LOW);
delay(100);
digitalWrite(grun2, HIGH);
delay(5000);
digitalWrite(grun2, LOW);
digitalWrite(gelb2, HIGH);
delay(1000);
digitalWrite(gelb2, LOW);
digitalWrite(rot2, HIGH);
}