2
2
3
3
#define LED_PIN 7
4
4
#define NUM_LEDS 60
5
+ #define bright = 100
5
6
6
7
CRGB leds[NUM_LEDS];
7
8
8
9
char incoming_command = ' 0' ;
9
- long ran = random(NUM_LEDS);
10
- long de = random(1000 );
11
-
12
10
int l = 1 ;
13
11
boolean setting = 0 ;
14
12
15
- int bright = 50 ;
16
-
17
13
void check_for_input () {
18
14
if (Serial.available () > 0 ) {
19
15
// read the incoming byte:
@@ -34,29 +30,14 @@ void setup() {
34
30
35
31
void loop () {
36
32
int L = 60 -l;
37
- int M;
38
33
check_for_input ();
39
- if (incoming_command == ' G' ){
34
+ if (incoming_command == ' G' ){ // Activation and deactivation button for the second control
40
35
Serial.println (" Switching: " );
41
36
setting = !setting;
42
37
Serial.println (setting);
43
38
delay (1000 );
44
39
}
45
- // if (setting == 0){
46
- // M = 60;
47
- // }
48
- // else if (setting == 1){
49
- // M = L;
50
- // }
51
- else if (incoming_command == ' 1' ){
52
- Serial.println (" RED" );
53
- for (int i = 0 ; i <= L; i++) {
54
- leds[i] = CRGB (255 ,0 ,0 );
55
- FastLED.show ();
56
- delay (40 );
57
- }
58
- }
59
- else if (incoming_command == ' F' ){
40
+ else if (incoming_command == ' F' ){ // Choosing second person's amount of LEDs
60
41
for (int i = 60 ; i >= 0 ; i--) {
61
42
leds[i] = CRGB (0 ,0 ,0 );
62
43
FastLED.show ();
@@ -67,9 +48,6 @@ void loop() {
67
48
pl:
68
49
check_for_input ();
69
50
Serial.println (l);
70
- // while((incoming_command != 'A') || (incoming_command != 'B') || (incoming_command != 'D')){
71
- // check_for_input();
72
- // }
73
51
if (incoming_command == ' B' ){
74
52
if (l < 60 ){
75
53
l++;
@@ -80,10 +58,6 @@ void loop() {
80
58
l--;
81
59
}
82
60
}
83
- // for (int i = l; i >= 0; i--) {
84
- // leds[i] = CRGB (0,0,0);
85
- // FastLED.show();
86
- // }
87
61
leds[l] = CRGB (255 ,0 ,0 );
88
62
FastLED.show ();
89
63
if (incoming_command != ' A' ){
@@ -97,12 +71,21 @@ void loop() {
97
71
}
98
72
else if (incoming_command == ' 0' ){
99
73
Serial.println (" WHITE" );
100
- for (int i = 0 ; i <= L; i++) {// ///////////////////////////
74
+ for (int i = 0 ; i <= L; i++) {
101
75
leds[i] = CRGB (255 ,255 ,255 );
102
76
FastLED.show ();
103
77
delay (40 );
104
78
}
105
79
}
80
+ else if (incoming_command == ' 1' ){
81
+ Serial.println (" RED" );
82
+ for (int i = 0 ; i <= L; i++) {
83
+ leds[i] = CRGB (255 ,0 ,0 );
84
+ FastLED.show ();
85
+ delay (40 );
86
+ }
87
+ }
88
+
106
89
else if (incoming_command == ' 2' ){
107
90
Serial.println (" ORANGE" );
108
91
for (int i = 0 ; i <= L; i++) {
@@ -166,25 +149,6 @@ void loop() {
166
149
delay (40 );
167
150
}
168
151
}
169
- else if (incoming_command == ' E' ){
170
- sp:
171
- rainbowCycle (10 );
172
- if (incoming_command != ' A' ){
173
- goto sp;
174
- }
175
- }
176
- else if (incoming_command == ' B' ){
177
- if (bright < 100 ){
178
- bright++;
179
- }
180
- FastLED.setBrightness (bright);
181
- }
182
- else if (incoming_command == ' D' ){
183
- if (bright > 0 ){
184
- bright--;
185
- }
186
- FastLED.setBrightness (bright);
187
- }
188
152
else if (incoming_command == ' A' && setting == 0 ){
189
153
for (int i = 60 ; i >= 0 ; i--) {
190
154
leds[i] = CRGB (0 ,0 ,0 );
@@ -199,6 +163,18 @@ void loop() {
199
163
delay (40 );
200
164
}
201
165
}
166
+ else if (incoming_command == ' B' ){
167
+ if (bright < 100 ){
168
+ bright++;
169
+ }
170
+ FastLED.setBrightness (bright);
171
+ }
172
+ else if (incoming_command == ' D' ){
173
+ if (bright > 0 ){
174
+ bright--;
175
+ }
176
+ FastLED.setBrightness (bright);
177
+ }
202
178
else if (incoming_command == ' C' ){
203
179
for (int i = 0 ; i <= 60 ; i++) {
204
180
leds[i] = CRGB (0 ,0 ,0 );
@@ -220,6 +196,15 @@ void loop() {
220
196
goto st;
221
197
}
222
198
}
199
+ else if (incoming_command == ' E' ){
200
+ sp:
201
+ rainbowCycle (10 );
202
+ if (incoming_command != ' A' ){
203
+ goto sp;
204
+ }
205
+ }
206
+
207
+ // #2 Control
223
208
else if (incoming_command == ' Q' && setting == 1 ){
224
209
Serial.println (" WHITE2" );
225
210
for (int i = L; i <= 60 ; i++) {
@@ -301,11 +286,6 @@ void loop() {
301
286
}
302
287
}
303
288
304
-
305
-
306
-
307
-
308
-
309
289
void rainbowCycle (int SpeedDelay) {
310
290
byte *c;
311
291
uint16_t i, j;
@@ -348,10 +328,6 @@ byte * Wheel(byte WheelPos) {
348
328
return c;
349
329
}
350
330
351
-
352
-
353
-
354
-
355
331
void showStrip () {
356
332
#ifdef ADAFRUIT_NEOPIXEL_H
357
333
// NeoPixel
0 commit comments