fix serial rx flush in examples

This commit is contained in:
Morgan Redfield 2019-09-07 19:43:11 -07:00
parent aa14035c94
commit ef2268ca22
2 changed files with 2 additions and 2 deletions

View File

@ -166,7 +166,7 @@ void loop() {
} else { } else {
Serial.setTimeout(40); Serial.setTimeout(40);
freq = Serial.parseInt(); freq = Serial.parseInt();
Serial.flush(); while (Serial.available()) Serial.read();
radio.frequency(freq); radio.frequency(freq);
Serial.print("set frequency: "); Serial.print("set frequency: ");
Serial.println(freq); Serial.println(freq);

View File

@ -135,7 +135,7 @@ void loop() {
} else { } else {
Serial.setTimeout(40); Serial.setTimeout(40);
freq = Serial.parseInt(); freq = Serial.parseInt();
Serial.flush(); while (Serial.available()) Serial.read();
radio.frequency(freq); radio.frequency(freq);
Serial.print("set frequency: "); Serial.print("set frequency: ");
Serial.println(freq); Serial.println(freq);