From 87cda5de601e57cae7387ed54820e891b7fe81cf Mon Sep 17 00:00:00 2001 From: Jake Hillion Date: Sun, 26 Apr 2020 20:11:52 +0100 Subject: [PATCH] Fixed logic errors in arduino --- arduino/arduino.ino | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/arduino/arduino.ino b/arduino/arduino.ino index c405e7c..5a22faf 100644 --- a/arduino/arduino.ino +++ b/arduino/arduino.ino @@ -27,25 +27,7 @@ int stored[3]; void loop() { if (Serial.available() > 0) { int data; - 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; + switch (data = Serial.read()) { case 'n': nextColour(); break; @@ -58,6 +40,9 @@ void loop() { case 'r': resetState(); 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++) { leds[strip][i] = color; } - + + led++ rgb = hex = 0; }