-
Notifications
You must be signed in to change notification settings - Fork 1
/
Main.ino
127 lines (117 loc) · 3.2 KB
/
Main.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
#include <FastLED.h>
#include "src/led_control/led_control.h"
// Define the array of leds
LEDPanel test_panel = LEDPanel(2, 5);
LEDPanel upper_test_panel = LEDPanel(1, 5);
int target = 1;
int upper_target = 1;
void setup()
{
FastLED.setBrightness(255);
Serial.begin(57600);
Serial.println("resetting");
}
// What we're really going to want to do, I think, is have a master counter in the main loop, and have separate functions for each type of effect
// Each with it's own parameters or something, each maybe with different framerates so things are more dynamic, if we want.
// This example merely runs a single red pixel down the lengths of the two strips. Just a proof of concept.
void loop()
{
// First slide the led in one direction
Serial.println("Update Phase");
bool done;
bool upper_done;
if(target == 1)
{
CRGB color = CRGB::Blue;
done = test_panel.WipeHorizontal(color.red, color.green, color.blue, 1, 0.5, 5);
}
else if(target == 2)
{
CRGB color = CRGB::OrangeRed;
done = test_panel.WipeHorizontal(color.red, color.green, color.blue, 0, 0.5, 5);
}
else if(target == 3)
{
CRGB color = CRGB::Yellow;
done = test_panel.Explosion(color.red, color.green, color.blue, 1, 1.0, 0);
}
else if(target == 4)
{
CRGB color = CRGB::Green;
done = test_panel.WipeVertical(color.red, color.green, color.blue, 0, 1.0, 0);
}
else if(target == 5)
{
CRGB color = CRGB::Blue;
done = test_panel.WipeVertical(color.red, color.green, color.blue, 1, 1.0, 0);
}
else
{
CRGB color = CRGB::Purple;
done = test_panel.WipeVertical(color.red, color.green, color.blue, 0, 1.0, 0);
}
if(done)
{
// This initialization logic should be moved into the function, somehow.
if(target == 1)
target = 2;
else if(target == 2)
target = 3;
else if(target == 3)
target = 4;
else if(target == 4)
target = 5;
else if(target == 5)
target = 6;
else if(target == 6)
target = 1;
}
if(upper_target == 1)
{
CRGB color = CRGB::Blue;
upper_done = upper_test_panel.WipeHorizontal(color.red, color.green, color.blue, 1, 0.5, 5);
}
else if(upper_target == 2)
{
CRGB color = CRGB::OrangeRed;
upper_done = upper_test_panel.WipeHorizontal(color.red, color.green, color.blue, 0, 0.5, 5);
}
else if(upper_target == 3)
{
CRGB color = CRGB::Yellow;
upper_done = upper_test_panel.Explosion(color.red, color.green, color.blue, 1, 1.0, 0);
}
else if(upper_target == 4)
{
CRGB color = CRGB::Green;
upper_done = upper_test_panel.WipeVertical(color.red, color.green, color.blue, 0, 1.0, 0);
}
else if(upper_target == 5)
{
CRGB color = CRGB::Blue;
upper_done = upper_test_panel.WipeVertical(color.red, color.green, color.blue, 1, 1.0, 0);
}
else
{
CRGB color = CRGB::Purple;
upper_done = upper_test_panel.WipeVertical(color.red, color.green, color.blue, 0, 1.0, 0);
}
if(upper_done)
{
// This initialization logic should be moved into the function, somehow.
if(upper_target == 1)
upper_target = 2;
else if(upper_target == 2)
upper_target = 3;
else if(upper_target == 3)
upper_target = 4;
else if(upper_target == 4)
upper_target = 5;
else if(upper_target == 5)
upper_target = 6;
else if(upper_target == 6)
upper_target = 1;
}
FastLED.show();
delay(1000/30);
}