-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRGB_LED_Fade.ino
135 lines (124 loc) · 2.87 KB
/
RGB_LED_Fade.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
int rpin1 = 3;
int gpin1 = 5;
int bpin1 = 6;
int rpin2 = 9;
int gpin2 = 10;
int bpin2 = 11;
int count1;
int count2;
int count3;
int count4;
int count5;
int count6;
void setup() {
pinMode(rpin1, OUTPUT);
pinMode(gpin1, OUTPUT);
pinMode(bpin1, OUTPUT);
pinMode(rpin2, OUTPUT);
pinMode(gpin2, OUTPUT);
pinMode(bpin2, OUTPUT);
count1 = 0;
count2 = 255;
count3 = 255;
count4 = 0;
count5 = 255;
count6 = 255;
analogWrite(rpin1, count1);
analogWrite(gpin1, count2);
analogWrite(bpin1, count3);
analogWrite(rpin2, count4);
analogWrite(gpin2, count5);
analogWrite(bpin2, count6);
}
void loop() {
for (int count = 0; count <= 255; count ++) {
count1 = 0;
count2 = 255 - count;
count3 = 255;
count4 = 0;
count5 = 255;
count6 = 255 - count;
analogWrite(rpin1, count1);
analogWrite(gpin1, count2);
analogWrite(bpin1, count3);
analogWrite(rpin2, count4);
analogWrite(gpin2, count5);
analogWrite(bpin2, count6);
delay(30);
}
for (int count = 255; count >= 0; count --) {
count1 = 255 - count;
count2 = 0;
count3 = 255;
count4 = 255 - count;
count5 = 255;
count6 = 0;
analogWrite(rpin1, count1);
analogWrite(gpin1, count2);
analogWrite(bpin1, count3);
analogWrite(rpin2, count4);
analogWrite(gpin2, count5);
analogWrite(bpin2, count6);
delay(30);
}
for (int count = 0; count <= 255; count ++) {
count1 = 255;
count2 = 0;
count3 = 255 - count;
count4 = 255;
count5 = 255 - count;
count6 = 0;
analogWrite(rpin1, count1);
analogWrite(gpin1, count2);
analogWrite(bpin1, count3);
analogWrite(rpin2, count4);
analogWrite(gpin2, count5);
analogWrite(bpin2, count6);
delay(30);
}
for (int count = 255; count >= 0; count --) {
count1 = 255;
count2 = 255 - count;
count3 = 0;
count4 = 255;
count5 = 0;
count6 = 255 - count;
analogWrite(rpin1, count1);
analogWrite(gpin1, count2);
analogWrite(bpin1, count3);
analogWrite(rpin2, count4);
analogWrite(gpin2, count5);
analogWrite(bpin2, count6);
delay(30);
}
for (int count = 0; count <= 255; count ++) {
count1 = 255 - count;
count2 = 255;
count3 = 0;
count4 = 255 - count;
count5 = 0;
count6 = 255;
analogWrite(rpin1, count1);
analogWrite(gpin1, count2);
analogWrite(bpin1, count3);
analogWrite(rpin2, count4);
analogWrite(gpin2, count5);
analogWrite(bpin2, count6);
delay(30);
}
for (int count = 255; count >= 0; count --){
count1 = 0;
count2 = 255;
count3 = 255 - count;
count4 = 0;
count5 = 255 - count;
count6 = 255;
analogWrite(rpin1, count1);
analogWrite(gpin1, count2);
analogWrite(bpin1, count3);
analogWrite(rpin2, count4);
analogWrite(gpin2, count5);
analogWrite(bpin2, count6);
delay(30);
}
}