Move light firmware to own dir

Reduce cognitive load of firmware, can only set color. Must set black
via client.
This commit is contained in:
mmcwilliams 2016-04-11 13:08:14 -04:00
parent d902c26a70
commit 7e1e80f770
1 changed files with 5 additions and 10 deletions

View File

@ -29,7 +29,7 @@ void setup () {
Serial.begin(57600); Serial.begin(57600);
Serial.flush(); Serial.flush();
pixieSerial.begin(115200); // Pixie REQUIRES this baud rate pixieSerial.begin(115200); // Pixie REQUIRES this baud rate
black(); light.setPixelColor(0, 0, 0, 0);
} }
void loop () { void loop () {
@ -44,26 +44,21 @@ void loop () {
} }
// //
//b - off
//c - color - followed by String //c - color - followed by String
// //
void cmd (char val) { void cmd (char val) {
if (val == 'b') { if (val == 'c') {
black();
} else if (val == 'c') {
colorString(); colorString();
Serial.println("c");//End of action
} }
} }
void black () {
light.setPixelColor(0, 0, 0, 0);
}
void colorString () { void colorString () {
while (Serial.available() == 0) { while (Serial.available() == 0) {
//Wait for color string //Wait for color string
} }
color = Serial.readString(); color = Serial.readString();
//Serial.println(color);
commaR = color.indexOf(','); //comma trailing R commaR = color.indexOf(','); //comma trailing R
commaG = color.indexOf(',', commaR + 1); commaG = color.indexOf(',', commaR + 1);
@ -80,4 +75,4 @@ void colorString () {
a = strA.toInt(); a = strA.toInt();
light.setPixelColor(r, g, b, a); light.setPixelColor(r, g, b, a);
} }