Fixed logic errors in arduino

This commit is contained in:
Jake Hillion 2020-04-26 20:11:52 +01:00
parent 25bbed17c0
commit 87cda5de60

View File

@ -27,25 +27,7 @@ int stored[3];
void loop() { void loop() {
if (Serial.available() > 0) { if (Serial.available() > 0) {
int data; int data;
switch (data = Serial.read()) { switch (data = Serial.read()) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
hex = (hex << 2) + charMap(data);
break;
case 'n': case 'n':
nextColour(); nextColour();
break; break;
@ -58,6 +40,9 @@ void loop() {
case 'r': case 'r':
resetState(); resetState();
break; break;
default:
hex = (hex << 1) + charMap(data);
break;
} }
} }
} }
@ -76,7 +61,8 @@ void nextLed() {
for (int i = start; i < start + NUM_LEDS_PER_SQUARE; i++) { for (int i = start; i < start + NUM_LEDS_PER_SQUARE; i++) {
leds[strip][i] = color; leds[strip][i] = color;
} }
led++
rgb = hex = 0; rgb = hex = 0;
} }