-
Notifications
You must be signed in to change notification settings - Fork 0
/
PatternCylon.h
79 lines (62 loc) · 1.64 KB
/
PatternCylon.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// *****************************************
// Cylon
// *****************************************
extern uint8_t around[];
uint8_t gCylonDelay = 30;
boolean gCylonCycleColor = true;
uint8_t gCylonTrail = 200;
void fadeall() {
for(int i = 0; i < NUM_LEDS; i++)
{
gLeds[i].nscale8(gCylonTrail);
}
}
void fCylon() {
static uint8_t localHue = 0;
static uint8_t localIndex = 0;
fadeall();
// Set the index led to localHue
gLeds[around[localIndex]] = CHSV(localHue, 255, 255);
if (gCylonCycleColor) localHue++;
localIndex++;
if (localIndex == EDGE_LEDS) {
localIndex = 0;
}
FastLED.delay(gCylonDelay);
}
// *****************************************
// Cycle
// *****************************************
String setCylonCycleColor(String value) {
gCylonCycleColor = value.toInt();
storageWrite("cylonCycle");
broadcastInt("cylonCycle", gCylonCycleColor);
return String(gCylonCycleColor);
}
String getCylonCycleColor() {
return String(gCylonCycleColor);
}
// *****************************************
// Trail
// *****************************************
String setCylonTrail(String value) {
gCylonTrail = value.toInt();
storageWrite("cylonTrail");
broadcastInt("cylonTrail", gCylonTrail);
return String(gCylonTrail);
}
String getCylonTrail() {
return String(gCylonTrail);
}
// *****************************************
// Delay
// *****************************************
String setCylonDelay(String value) {
gCylonDelay = value.toInt();
storageWrite("cylonDelay");
broadcastInt("cylonDelay", gCylonDelay);
return String(gCylonDelay);
}
String getCylonDelay() {
return String(gCylonDelay);
}