forked from alexisisaac/MashedPixels
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRedWaveMode.cpp
More file actions
26 lines (25 loc) · 755 Bytes
/
RedWaveMode.cpp
File metadata and controls
26 lines (25 loc) · 755 Bytes
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
#include "RedWaveMode.h"
RedWaveMode::RedWaveMode(int pCount){
count = pCount;
}
void RedWaveMode::init(){
}
void RedWaveMode::loop(CRGB *leds){
CRGB color;
color.setRGB(random(0,255),random(0,255),random(0,255));
int last=-100;
for(int whiteLed = 0; whiteLed < count; whiteLed = whiteLed + 1) {
// Turn our current led on to white, then show the leds
double v = sin(whiteLed*0.3+millis()/1000.0)*255;
if (v>240 && random(0,100)>90 && whiteLed-last>10){
last = whiteLed;
leds[whiteLed].g = 250;
leds[whiteLed].r = 255;
leds[whiteLed].b = 252;
} else {
leds[whiteLed].g = constrain(v, 0, 255);
leds[whiteLed].r = 0;
leds[whiteLed].b = 0;
}
}
}