Newer
Older
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
int NumLEDs::start(String args) {
int val = args.toInt();
//Always clear the strip first
_strip->clear();
if( val > 0 ) {
_strip->fill(_color, 0, val);
}
_strip->show();
return "";
};
char * NumLEDs::args() {return "<int num_leds>"; };
int BrightnessLEDs::start(String args) {
int val = args.toInt();
_strip->clear();
_strip->fill(_strip->ColorHSV(_hue,_sat,val));
_strip->show();
return "";
};
char * BrightnessLEDs::args() {return "<int brightness>"; };
void BreathingLEDs::update() {
if( _rate <= 0 ) {
_strip->fill(0);
_strip->show();
return;
}
_current = _current + (_rate * _direction);
if( _current < 0 ) {
_current = 0;
_direction = 1;
}
if( _current > 255 * _factor ) {
_current = 255 * _factor;
_direction = -1;
}
_strip->fill(_strip->ColorHSV(_hue,_sat,_current / _factor));
_strip->show();
};
int BreathingLEDs::start(String args) {
_current = 0;
_direction = 1;
_running = true;
int val = args.toInt();
_rate = val;
return "";
};
char * BreathingLEDs::args() {return "<int rate (1-255ish)>"; };