-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharduino_operator_board_control.ino
69 lines (63 loc) · 1.34 KB
/
arduino_operator_board_control.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
#include <singleLEDLibrary.h>
sllib lightCone(2);
sllib lightCube(3);
// Unused
sllib lightGround(4);
// Unused
sllib lightPortal(5);
sllib lightTL(6);
sllib lightTM(7);
sllib lightTR(8);
sllib lightML(9);
sllib lightMM(10);
sllib lightMR(11);
sllib lightBL(12);
sllib lightBM(13);
sllib lightBR(14);
sllib allLights[] = {
lightCone, lightCube,
lightTL, lightTM, lightTR,
lightML, lightMM, lightMR,
lightBL, lightBM, lightBR,
};
sllib coneLights[] = {
lightCone,
lightTL, lightTR,
lightML, lightMR,
lightBL, lightBR,
};
sllib cubeLights[] = {
lightCube,
lightTM,
lightMM,
lightBM,
};
void setup() {
Serial.begin(9600);
}
void loop() {
while (Serial.available() > 0) {
static char message[256];
static unsigned int message_pos = 0;
char inByte = Serial.read();
if (inByte != '\n') {
message[message_pos] = inByte;
message_pos++;
}
else {
message_pos = 0;
// process message
for (sllib light : allLights) light.update();
// cone
if (message[0] == '1') {
for (sllib light : cubeLights) light.setOffSingle();
for (sllib light : coneLights) light.setOnSingle();
}
// cube
if (message[0] == '0') {
for (sllib light : cubeLights) light.setOnSingle();
for (sllib light : coneLights) light.setOffSingle();
}
}
}
}