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: }