-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4_rgb_blink.ino
More file actions
80 lines (63 loc) · 1.17 KB
/
4_rgb_blink.ino
File metadata and controls
80 lines (63 loc) · 1.17 KB
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
Morse code sheet: https://drive.google.com/file/d/1liBuEK5mu3E04ymCv_On7b9cEDAkBJO1/view
Challenges:
1) Make police car light pattern
2) Red Blink, Green Blink, Blue Blink
3) Colors of the rainbow (ROYGBIV)
Color guide: https://www.rapidtables.com/web/color/RGB_Color.html
*/
#define RED 3
#define BLUE 5
#define GREEN 6
void setup() {
pinMode(RED,OUTPUT); //- RED
pinMode(BLUE,OUTPUT); //- BLUE
pinMode(GREEN,OUTPUT); //- GREEN
pinMode(7,OUTPUT);
}
void dot() {
digitalWrite(7,HIGH);
delay(100);
digitalWrite(7,LOW);
delay(100);
}
void dash() {
digitalWrite(7,HIGH);
delay(300);
digitalWrite(7,LOW);
delay(100);
}
void rgbOff() {
analogWrite(RED,0);
analogWrite(BLUE,0);
analogWrite(GREEN,0);
}
void rgbRed() {
analogWrite(RED,255);
analogWrite(BLUE,0);
analogWrite(GREEN,0);
}
void rgbBlue() {
analogWrite(RED,0);
analogWrite(BLUE,255);
analogWrite(GREEN,0);
}
void rgbGreen() {
analogWrite(RED,0);
analogWrite(BLUE,0);
analogWrite(GREEN,255);
}
void loop() {
rgbRed();
delay(500);
rgbOff();
delay(500);
rgbGreen();
delay(500);
rgbOff();
delay(500);
rgbBlue();
delay(500);
rgbOff();
delay(500);
}