-
Notifications
You must be signed in to change notification settings - Fork 4
/
TrafficLight.ino
47 lines (41 loc) · 1.34 KB
/
TrafficLight.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
// _ ___ _______ ___ ___ ___ ___ _ _ ___ _____ ___
// / |_ )__ / \ / __|_ _| _ \/ __| | | |_ _|_ _/ __|
// | |/ / |_ \ |) | | (__ | || / (__| |_| || | | | \__ \
// |_/___|___/___/ \___|___|_|_\\___|\___/|___| |_| |___/
//
// Semáforo Arduino
//
// Author: Niam Moltta
// License: MIT
// Downloaded from: https://circuits.io/circuits/3642162-semaforo-arduino
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(8, OUTPUT);
pinMode(10, OUTPUT);
pinMode(12, OUTPUT);
}
void loop() {
digitalWrite(8, HIGH); //red on
delay(5000); //eight seconds
digitalWrite(8, LOW); //red off
digitalWrite(12, HIGH); //green on
delay(5000); //three seconds
digitalWrite(12, LOW); //green off
delay(500);
digitalWrite(12, HIGH); //green on
delay(500); //one second
digitalWrite(12, LOW); //green off
delay(500);
digitalWrite(12, HIGH); //green on
delay(500); //one second
digitalWrite(12, LOW); //green off
delay(500);
digitalWrite(12, HIGH); //green on
delay(500); // one sec
digitalWrite(12, LOW); //green off
digitalWrite(10, HIGH); //yellow on
delay(3000); //three sec
digitalWrite(10, LOW); //yellow off
//repeat from the beginning
}