From c559b3949f402f15146d71da046960bbb53ad7d1 Mon Sep 17 00:00:00 2001 From: David Madison Date: Thu, 8 Jun 2017 16:28:17 -0400 Subject: [PATCH] Added serial buffer flush option --- Arduino/LEDstream_FastLED/LEDstream_FastLED.ino | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino index a261182..d581359 100644 --- a/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino +++ b/Arduino/LEDstream_FastLED/LEDstream_FastLED.ino @@ -40,6 +40,7 @@ static const uint16_t // --- Optional Settings (uncomment to add) //#define CLEAR_ON_START // LEDs are cleared on reset +//#define SERIAL_FLUSH // Serial buffer cleared on LED latch //#define GROUND_PIN 10 // additional grounding pin (optional) //#define CALIBRATE // sets all LEDs to the color of the first @@ -214,6 +215,9 @@ void dataMode(){ FastLED.show(); D_FPS; D_LED(OFF); + #ifdef SERIAL_FLUSH + serialFlush(); + #endif } } @@ -245,3 +249,9 @@ void timeouts(){ } } } + +void serialFlush(){ + while(Serial.available() > 0) { + byte r = Serial.read(); + } +}