-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathneoLightCtl.ino
49 lines (40 loc) · 859 Bytes
/
neoLightCtl.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
#include "simpleNeopixel.h"
#define PIXELS 144 // Number of pixels in the string
char incomingCommand[30];
int incComOffset = 0;
void parseSerial() {
if (Serial.available()) {
char incomingByte = Serial.read();
incomingCommand[incComOffset]=incomingByte;
incComOffset = (incComOffset + 1) % sizeof(incomingCommand);
if (incomingByte == ';') for(
int i = incComOffset+1;
i != incComOffset;
i = (i + 1) % sizeof(incomingCommand)
) {
Serial.print( incomingCommand[i] );
incomingCommand[i] = '\0';
}
}
}
int t=0;
void displayLights() {
t=(1+t)%PIXELS;
for (int i = 0; i < PIXELS-2; i++) {
if(i==t) {
sendPixel(10,10,0);
sendPixel(10,10,0);
sendPixel(10,10,0);
} else
sendPixel(0,3,3);
}
}
void setup() {
ledsetup();
Serial.begin(9600);
}
void loop() {
displayLights();
show();
parseSerial();
}