forked from agwn/movie2serial
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DemoTransmitter.pde
executable file
·51 lines (42 loc) · 1.05 KB
/
DemoTransmitter.pde
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
class DemoTransmitter extends Thread {
int animationStep = 0;
int stepSize = 5;
color[] MakeDemoFrame() {
int image_size = ledCount;
color[] imageData = new color[image_size];
for (int i = 0; i < imageData.length; i++) {
if (animationStep == i%stepSize) {
if (i > int(imageData.length*2/3.0)) {
imageData[i] = color(0, 0, 128);
}
else if (i > int(imageData.length/3.0)) {
imageData[i] = color(0, 128, 0);
}
else {
imageData[i] = color(128, 0, 0);
}
}
else {
imageData[i] = color(0, 0, 0);
}
}
animationStep = (animationStep + 1)%stepSize;
return imageData;
}
DemoTransmitter() {
}
void run() {
while (demoMode) {
try {
if (newImageQueue.size() < 1) {
color imageData[] = MakeDemoFrame();
newImageQueue.put(imageData);
}
Thread.sleep(250);
}
catch( InterruptedException e ) {
println("Interrupted Exception caught");
}
}
}
}