-
Notifications
You must be signed in to change notification settings - Fork 2
/
RandomMarquee.h
56 lines (47 loc) · 1.21 KB
/
RandomMarquee.h
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
#pragma once
#include "Namespace.h"
#include "Config.h"
#include "Color.h"
#include "Interval.h"
#include "Pattern.h"
LED_CONTROLLER_NAMESPACE_ENTER
/**
* A sequence of random Colors which marches along an LED strip.
*/
class RandomMarquee : public Pattern {
private:
Color colors[STRIP_LENGTH];
Interval addColorInterval;
int startIndex;
const int brightInterval;
const float scaleBright, scaleDim;
void advance();
/**
* Put some known colors at the beginning of the marquee.
*/
void setStartColors();
public:
RandomMarquee();
/**
* @param brightInterval Make every nth color brighter.
* @param scaleBright scale factor by which to adjust every
* nth (bright) color
* @param scaleDim scale factor by which to adjust all but the
* nth (the dim) colors
*/
RandomMarquee(int brightInterval,
float scaleBright, float scaleDim);
/**
* Every interval, shift all the Colors one along the strip
* and add a new random Color at the beginning.
*
* @return whether the marquee changed (moved)
*/
bool update();
void apply(Color* stripColors);
/**
* Set the millisecond interval between moves.
*/
void setInterval(int interval);
};
LED_CONTROLLER_NAMESPACE_EXIT