-
Notifications
You must be signed in to change notification settings - Fork 2
/
PWM_1_Standard.ino
671 lines (531 loc) · 23 KB
/
PWM_1_Standard.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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void rainbow_RGB() { rainbow(RainbowColors_p); }
void rainbow_Party() { rainbow(PartyColors_p); }
void rainbow_Ocean() { rainbow(OceanColors_p); }
void rainbow_Cloud() { rainbow(CloudColors_p); }
void rainbow_Lava() { rainbow(LavaColors_p); }
void rainbow_Forest() { rainbow(ForestColors_p); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void rainbow(CRGBPalette16 palette)
{
if (addressableStrip == true) {
uint8_t colorIndex = startIndex; //startIndex+1;
uint8_t patternLength = map(patternAdj, 0, 30, 1, 10);
for( int i = 0; i < stripLength; i++) {
leds[i] = ColorFromPalette( palette, colorIndex, brightness, currentBlending);
colorIndex += patternLength;
}
}
else {
//gHue = gHue + 1;
gHue = gHue + (patternSpeed/5);
displaySolid( ColorFromPalette(palette, gHue ));
//delay(5);
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void rainbowWithGlitter()
{
if (addressableStrip == true) {
// built-in FastLED rainbow, plus some random sparkly glitter
rainbow(RainbowColors_p);
//addGlitter(80, CRGB::White);
addGlitter(255, CRGB::White);
}
else {
//gHue = gHue + 1;
// Use FastLED automatic HSV->RGB conversion
rainbow(RainbowColors_p);
}
}
void addGlitter( fract8 chanceOfGlitter, CRGB gColor)
{
if ( random8() < chanceOfGlitter) {
leds[ random8(stripLength) ] = gColor;
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void confetti()
{
if (addressableStrip == true) {
// random colored speckles that blink in and fade smoothly
fadeToBlackBy( leds, stripLength, 10);
pos = random8(stripLength);
leds[pos] += CHSV( gHue + random8(64), 200, 255);
}
else {
//flash bright rand colors
displaySolid(CHSV( gHue + random8(32), 200, 255));
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void sinelon_RGB() { sinelon(RainbowColors_p); }
void sinelon_Party() { sinelon(PartyColors_p); }
void sinelon_Ocean() { sinelon(OceanColors_p); }
void sinelon_Cloud() { sinelon(CloudColors_p); }
void sinelon_Lava() { sinelon(LavaColors_p); }
void sinelon_Forest() { sinelon(ForestColors_p); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void sinelon(CRGBPalette16 palette)
{
if (addressableStrip == true) {
// a colored dot sweeping back and forth, with fading trails
fadeToBlackBy( leds, stripLength, 40);
pos = beatsin8(15,0,stripLength-1);
if( pos < prevpos ) {
fill_solid( leds+pos, (prevpos-pos)+1, ColorFromPalette(palette, gHue )); //moveing back towards 0
}
else {
fill_solid( leds+prevpos, (pos-prevpos)+1, ColorFromPalette(palette, gHue )); //moving towards leds[stripLength]
}
prevpos = pos;
}
else {
gHue = gHue + (patternSpeed/5);
displaySolid( ColorFromPalette(palette, gHue ));
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void shot_Red() { shot(RED); }
void shot_Blue() { shot(BLUE); }
void shot_White() { shot(WHITE); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void shot(CRGB gColor)
{
// Adjust the contrast ratio between the moving dot to the relative background
uint8_t dimming = map(patternAdj, 0 ,31 , 0, 220);
// Adjust the fill density and therefore relative speed of the moving dot
uint8_t Speed = map(patternSpeed, 0, 31, 1, 5);
if (addressableStrip == true) {
pos = prevpos + Speed;
if (pos >= stripLength){ pos = 0; }
fadeToBlackBy( leds, stripLength, 10);
for(int i = 0; i < stripLength; i++) {
if ((random8() > 180) && (leds[i].getAverageLight() > 20) )
leds[i].addToRGB(leds[i].getAverageLight()*2);
leds[i].fadeToBlackBy( random8(40,200) );
}
fill_solid( leds+prevpos, (pos-prevpos)+1, gColor);
prevpos = pos;
}
else {
displaySolid(gColor);
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void bpm_RGB() { bpm(RainbowColors_p); }
void bpm_Party() { bpm(PartyColors_p); }
void bpm_Ocean() { bpm(OceanColors_p); }
void bpm_Cloud() { bpm(CloudColors_p); }
void bpm_Lava() { bpm(LavaColors_p); }
void bpm_Forest() { bpm(ForestColors_p); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void bpm(CRGBPalette16 palette)
{
if (addressableStrip == true) {
// colored stripes pulsing at a defined Beats-Per-Minute (BPM)
uint8_t BeatsPerMinute = map(patternSpeed, 0, 30, 30, 140);//62;
uint8_t patternLength = map(patternAdj, 0, 30, 5, 30);
uint8_t beat = beatsin8( BeatsPerMinute, 64, 255);
//uint8_t beat = beatsin8( map(patternSpeed, 0, 30, 10, 200), 0, 255);
for ( int i = 0; i < stripLength; i++) {
//leds[i] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i *30));
leds[i] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * patternLength));
}
}
else {
gHue = gHue + (patternSpeed/5);
displaySolid( ColorFromPalette(palette, gHue ));
//delay(5);
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void Fire2012_Low() { Fire2012(120 , 80); }
void Fire2012_High() { Fire2012(90, 60); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
// Adapted from Fire2012 by Mark Kriegsman
// FastLED Demo Code: https://github.com/FastLED/FastLED/tree/master/examples/Fire2012
void Fire2012(uint8_t SPARKING, uint8_t COOLING)
{
if (addressableStrip == true) {
// Array of temperature readings at each simulation cell
static byte heat[NUM_LEDS];
// SPARKING: What chance (out of 255) is there that a new spark will be lit?
// Higher chance = more roaring fire. Lower chance = more flickery fire.
// Default 120, suggested range 50-200.
//uint8_t SPARKING = map(patternAdj, 0, 30, 50, 200); //120
// COOLING: How much does the air cool as it rises?
// Less cooling = taller flames. More cooling = shorter flames.
// Default 50, suggested range 20-100
//uint8_t COOLING = map(patternSpeed, 0, 30, 20,100); //80
bool gReverseDirection = false;
currentPalette = LavaColors_p;
// Step 1. Cool down every cell a little
for ( int i = 0; i < stripLength; i++) {
heat[i] = qsub8( heat[i], random8(0, ((COOLING * 10) / stripLength) + 2));
}
// Step 2. Heat from each cell drifts 'up' and diffuses a little
for ( int k = stripLength - 1; k >= 2; k--) {
heat[k] = (heat[k - 1] + heat[k - 2] + heat[k - 2] ) / 3;
}
// Step 3. Randomly ignite new 'sparks' of heat near the bottom
if ( random8() < SPARKING ) {
int y = random8(7);
heat[y] = qadd8( heat[y], random8(160, 255) );
}
// Step 4. Map from heat cells to LED colors
for ( int j = 0; j < stripLength; j++) {
CRGB color = HeatColor( heat[j]);
int pixelnumber;
if ( gReverseDirection ) {
pixelnumber = (stripLength - 1) - j;
}
else {
pixelnumber = j;
}
leds[pixelnumber] = color;
}
}
else {
gHue = gHue + (patternSpeed/5);
displaySolid( ColorFromPalette(currentPalette, gHue ));
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void drawTwinkles_RGB() { drawTwinkles(RainbowColors_p); }
void drawTwinkles_Party() { drawTwinkles(PartyColors_p); }
void drawTwinkles_Ocean() { drawTwinkles(OceanColors_p); }
void drawTwinkles_Cloud() { drawTwinkles(CloudColors_p); }
void drawTwinkles_Lava() { drawTwinkles(LavaColors_p); }
void drawTwinkles_Forest() { drawTwinkles(ForestColors_p); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
//Adapted from Mark Kriegsman's code "TwinkleFOX"
//https://gist.github.com/kriegsman/756ea6dcae8e30845b5a
// Background color for 'unlit' pixels
// Can be set to CRGB::Black if desired.
// CRGB gBackgroundColor = CRGB::Black;
// Example of dim incandescent fairy light background color
// CRGB gBackgroundColor = CRGB(CRGB::FairyLight).nscale8_video(16);
// If COOL_LIKE_INCANDESCENT is set to 1, colors will
// fade out slighted 'reddened', similar to how
// incandescent bulbs change color as they get dim down.
#define COOL_LIKE_INCANDESCENT 1
// This function loops over each pixel, calculates the
// adjusted 'clock' that this pixel should use, and calls
// "CalculateOneTwinkle" on each pixel. It then displays
// either the twinkle color of the background color,
// whichever is brighter.
void drawTwinkles( CRGBPalette16 palette )
{
currentPalette = palette;
// "PRNG16" is the pseudorandom number generator
// It MUST be reset to the same starting value each time
// this function is called, so that the sequence of 'random'
// numbers that it generates is (paradoxically) stable.
uint16_t PRNG16 = 11337;
uint32_t clock32 = millis();
// Set up the background color, "bg".
CRGB bg = CRGB::Black; // just use the explicitly defined background color
uint8_t backgroundBrightness = bg.getAverageLight();
if (addressableStrip == true) {
for( int i = 0; i < stripLength; i++) {
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
uint16_t myclockoffset16= PRNG16; // use that number as clock offset
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
// use that number as clock speed adjustment factor (in 8ths, from 8/8ths to 23/8ths)
uint8_t myspeedmultiplierQ5_3 = ((((PRNG16 & 0xFF)>>4) + (PRNG16 & 0x0F)) & 0x0F) + 0x08;
uint32_t myclock30 = (uint32_t)((clock32 * myspeedmultiplierQ5_3) >> 3) + myclockoffset16;
uint8_t myunique8 = PRNG16 >> 8; // get 'salt' value for this pixel
// We now have the adjusted 'clock' for this pixel, now we call
// the function that computes what color the pixel should be based
// on the "brightness = f( time )" idea.
CRGB c = computeOneTwinkle( myclock30, myunique8);
uint8_t cbright = c.getAverageLight();
int16_t deltabright = cbright - backgroundBrightness;
if( deltabright >= 32 || (!bg)) {
// If the new pixel is significantly brighter than the background color,
// use the new color.
leds[i] = c;
}
else if( deltabright > 0 ) {
// If the new pixel is just slightly brighter than the background color,
// mix a blend of the new color and the background color
leds[i] = blend( bg, c, deltabright * 8);
}
else {
// if the new pixel is not at all brighter than the background color,
// just use the background color.
leds[i] = bg;
}
}
}
else {
displaySolid( ColorFromPalette(palette, gHue ));
}
}
// This function takes a time in pseudo-milliseconds,
// figures out brightness = f( time ), and also hue = f( time )
// The 'low digits' of the millisecond time are used as
// input to the brightness wave function.
// The 'high digits' are used to select a color, so that the color
// does not change over the course of the fade-in, fade-out
// of one cycle of the brightness wave function.
// The 'high digits' are also used to determine whether this pixel
// should light at all during this cycle, based on the TWINKLE_DENSITY.
CRGB computeOneTwinkle( uint32_t ms, uint8_t salt)
{
// Overall twinkle density.
// 0 (NONE lit) to 8 (ALL lit at once).
uint8_t TWINKLE_DENSITY = map(patternAdj, 0, 30, 1, 8);
// Overall twinkle speed.
// 0 (VERY slow) to 8 (VERY fast).
// 4, 5, and 6 are recommended.
uint8_t TWINKLE_SPEED = map(patternSpeed, 0, 30, 3,7);
uint16_t ticks = ms >> (8-TWINKLE_SPEED);
uint8_t fastcycle8 = ticks;
uint16_t slowcycle16 = (ticks >> 8) + salt;
slowcycle16 += sin8( slowcycle16);
slowcycle16 = (slowcycle16 * 2053) + 1384;
uint8_t slowcycle8 = (slowcycle16 & 0xFF) + (slowcycle16 >> 8);
uint8_t bright = 0;
if( ((slowcycle8 & 0x0E)/2) < TWINKLE_DENSITY) {
bright = attackDecayWave8( fastcycle8);
}
uint8_t hue = slowcycle8 - salt;
CRGB c;
if( bright > 0) {
c = ColorFromPalette( currentPalette, hue, bright, NOBLEND);
if( COOL_LIKE_INCANDESCENT == 1 ) {
coolLikeIncandescent( c, fastcycle8);
}
}
else {
c = CRGB::Black;
}
return c;
}
// This function is like 'triwave8', which produces a
// symmetrical up-and-down triangle sawtooth waveform, except that this
// function produces a triangle wave with a faster attack and a slower decay:
//
// / \
// / \
// / \
// / \
//
uint8_t attackDecayWave8( uint8_t i)
{
if( i < 86) {
return i * 3;
}
else {
i -= 86;
return 255 - (i + (i/2));
}
}
// This function takes a pixel, and if its in the 'fading down'
// part of the cycle, it adjusts the color a little bit like the
// way that incandescent bulbs fade toward 'red' as they dim.
void coolLikeIncandescent( CRGB& c, uint8_t phase)
{
if( phase < 128) return;
uint8_t cooling = (phase - 128) >> 4;
c.g = qsub8( c.g, cooling);
c.b = qsub8( c.b, cooling * 2);
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void colorwaves_RGB() { colorwaves(RainbowColors_p); }
void colorwaves_Party() { colorwaves(PartyColors_p); }
void colorwaves_Ocean() { colorwaves(OceanColors_p); }
void colorwaves_Cloud() { colorwaves(CloudColors_p); }
void colorwaves_Lava() { colorwaves(LavaColors_p); }
void colorwavess_Forest() { colorwaves(ForestColors_p); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
// Adapted from Mark Kriegsman's code "ColorWavesWithPalettes"
// https://gist.github.com/kriegsman/8281905786e8b2632aeb
void colorwaves(CRGBPalette16 palette )
{
static uint16_t sPseudotime = 0;
static uint16_t sLastMillis = 0;
static uint16_t sHue16 = 0;
uint8_t sat8 = beatsin88( 87, 220, 250);
uint8_t brightdepth = beatsin88( 341, 96, 224);
uint16_t brightnessthetainc16 = beatsin88( 203, (25 * 256), (40 * 256));
uint8_t msmultiplier = beatsin88(147, 23, 60);
uint16_t hue16 = sHue16;//gHue * 256;
uint16_t hueinc16 = beatsin88(113, 300, 1500);
uint16_t ms = millis();
uint16_t deltams = ms - sLastMillis ;
sLastMillis = ms;
sPseudotime += deltams * msmultiplier;
sHue16 += deltams * beatsin88( 400, 5,9);
uint16_t brightnesstheta16 = sPseudotime;
if (addressableStrip == true) {
for( uint16_t i = 0 ; i < stripLength; i++) {
hue16 += hueinc16;
uint8_t hue8 = hue16 / 256;
uint16_t h16_128 = hue16 >> 7;
if( h16_128 & 0x100) {
hue8 = 255 - (h16_128 >> 1);
}
else {
hue8 = h16_128 >> 1;
}
brightnesstheta16 += brightnessthetainc16;
uint16_t b16 = sin16( brightnesstheta16 ) + 32768;
uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
bri8 += (255 - brightdepth);
uint8_t index = hue8;
index = scale8( index, 240);
CRGB newcolor = ColorFromPalette( palette, index, bri8);
uint16_t pixelnumber = i;
pixelnumber = (stripLength-1) - pixelnumber;
nblend( leds[pixelnumber], newcolor, 128);
}
}
else {
displaySolid( ColorFromPalette(palette, gHue ));
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void larsonScanner_Red() { larsonScanner(DARK_RED); }
void larsonScanner_Gray() { larsonScanner(GRAY); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
//Adapted from:
//https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#library
void larsonScanner(CRGB gColor){
uint8_t eyeSize = map(patternAdj, 0 ,31 , 8, 30);
uint8_t Speed = map(patternSpeed, 0, 31, 10, 35);
if (addressableStrip == true) {
pos = beatsin8(Speed,0+(eyeSize/2),stripLength-(eyeSize/2)-1);
fill_solid( leds, stripLength, BLACK );
fill_gradient_RGB(leds, pos-(eyeSize/2), BLACK, pos, gColor);
fill_gradient_RGB(leds, pos, gColor, pos+(eyeSize/2), BLACK);
}
else {
displaySolid(gColor);
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void lightChase_Red() { lightChase(DARK_RED); }
void lightChase_Blue() { lightChase(DARK_BLU); }
void lightChase_Gray() { lightChase(GRAY); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
// Adapted from:
// https://www.tweaking4all.com/hardware/arduino/adruino-led-strip-effects/#library
void lightChase(CRGB gColor){
// Adjust the contrast ratio between the moving dot to the relative background
uint8_t dimming = map(patternAdj, 0 ,31 , 0, 220);
// Adjust the fill density and therefore relative speed of the moving dot
uint8_t Speed = map(patternSpeed, 0, 31, 1, 5);
if (addressableStrip == true) {
pos = pos + Speed;
if (pos >= stripLength){ pos = 0; }
fill_solid( leds, stripLength, BLACK );
for(int i = 0; i < stripLength; i++) {
leds[i] = gColor;
//leds[i].fadeLightBy( dimming );
leds[i].fadeToBlackBy( 255 - dimming );
}
leds[pos] = gColor;
leds[pos].maximizeBrightness();
//prevpos = pos;
}
else {
displaySolid(gColor);
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void heartBeat_Red() { heartBeat(DARK_RED, 1000); }
void heartBeat_Blue() { heartBeat(DARK_BLU, 1000); }
void heartBeat_White() { heartBeat(WHITE, 1000); }
void heartBeat_Gray() { heartBeat(GRAY, 1000); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
// Adapted from Marc Miller's "heart_pulse_blood_flowing"
// https://github.com/marmilicious/FastLED_examples/blob/master/heart_pulse_blood_flowing.ino#L26
#define PULSELENGTH 300
#define PULSEOFFSET 280
void heartBeat(CRGB gColor, uint16_t cycleLength){
uint8_t bloodVal = qadd8( pulseWave8( millis(), cycleLength, PULSELENGTH-100 ), pulseWave8( millis() + PULSEOFFSET, cycleLength, PULSELENGTH ) );
if (addressableStrip == true) {
for (int i = 0; i < stripLength ; i++) {
leds[i] = gColor;
leds[i].fadeLightBy( 255 - bloodVal );
}
}
else {
displaySolid( gColor.fadeLightBy( 255 - bloodVal ));
}
}
uint8_t pulseWave8(uint32_t ms, uint16_t cycleLength, uint16_t pulseLength) {
uint8_t baseBrightness = 20; // Brightness of LEDs when not pulsing. Set to 0 for off.
uint16_t T = ms % cycleLength;
if ( T > pulseLength) return baseBrightness;
uint16_t halfPulse = pulseLength / 2;
if (T <= halfPulse ) {
return (T * 255) / halfPulse; //first half = going up
}
else {
return((pulseLength - T) * 255) / halfPulse; //second half = going down
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void breath_Red() { breath(DARK_RED, 1); }
void breath_Blue() { breath(DARK_BLU, 1); }
void breath_Gray() { breath(GRAY, 1); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
//Adapted from Stuart Taylor's "WS2811 - breathe demo"
//https://gist.github.com/hsiboy/4eae11073e9d5b21eae3
void breath(CRGB gColor, uint8_t Speed){
if (addressableStrip == true) {
fill_solid(leds, stripLength, gColor.fadeLightBy( constrain(255 -((exp(sin((millis()*Speed)/2000.0*PI)) - 0.36787944)*108.0) , 0,235)));
}
else {
displaySolid( gColor.fadeLightBy( 255 -((exp(sin((millis()*Speed)/2000.0*PI)) - 0.36787944)*108.0) ));
}
}
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void strobe_Red() { strobe(RED); }
void strobe_Blue() { strobe(BLUE); }
void strobe_Gold() { strobe(GOLD); }
void strobe_White() { strobe(WHITE); }
//---------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------
void strobe(CRGB gColor)
{
//uint8_t Speed = map(patternSpeed, 0, 31, 80, 255);
if ( beat8(255) > 80){
//beatsin8( 220, 0, 255) > 150){
displaySolid( gColor );
//leds.maximizeBrightness();
}
else{
displaySolid( BLACK );
}
}