From f3766de54f6f343fa31bb454011e320edabf2560 Mon Sep 17 00:00:00 2001 From: cs161079 Date: Tue, 21 Jan 2020 23:00:20 +0200 Subject: [PATCH] Update v1.1 --- autonomousCar/autonomousCar.ino | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/autonomousCar/autonomousCar.ino b/autonomousCar/autonomousCar.ino index ab975f3..3ae9d8f 100644 --- a/autonomousCar/autonomousCar.ino +++ b/autonomousCar/autonomousCar.ino @@ -92,6 +92,11 @@ void turnServo(int from, int deg){ } } +void serialFlush(){ + while(Serial.available() > 0) { + char t = Serial.read(); + } +} /* * Setup Wiring Components */ @@ -300,6 +305,7 @@ int Serial_Input() //Serial.print("Value:"); //Serial.println(number); // clear the string for new input: + serialFlush(); } // if you get a newline, print the string, then the string's value: }