Skip to content

Commit

Permalink
added the teensy changes for reading by frame
Browse files Browse the repository at this point in the history
  • Loading branch information
sambev committed Jan 18, 2014
1 parent c677e2e commit 6afdade
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions ledcontrol/ledcontrol.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ void setup() {

void loop() {
while (Serial.available() > 0) {
id = Serial.parseInt();
rval = Serial.parseInt();
gval = Serial.parseInt();
bval = Serial.parseInt();

if (Serial.read() == '\n') {
leds.setPixel(id, rval, gval, bval);
if (Serial.peek() == '\n') {
Serial.read(); // get rid of the new line
leds.show();
} else {
id = Serial.parseInt();
rval = Serial.parseInt();
gval = Serial.parseInt();
bval = Serial.parseInt();
leds.setPixel(id, rval, gval, bval);
}
}
}

0 comments on commit 6afdade

Please sign in to comment.