From ef2268ca22da30367a76b5c3b7acc1de53ecf473 Mon Sep 17 00:00:00 2001 From: Morgan Redfield Date: Sat, 7 Sep 2019 19:43:11 -0700 Subject: [PATCH] fix serial rx flush in examples --- examples/CTCSS/CTCSS.ino | 2 +- examples/HandyTalkie/HandyTalkie.ino | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/CTCSS/CTCSS.ino b/examples/CTCSS/CTCSS.ino index efbe162..b881f3c 100644 --- a/examples/CTCSS/CTCSS.ino +++ b/examples/CTCSS/CTCSS.ino @@ -166,7 +166,7 @@ void loop() { } else { Serial.setTimeout(40); freq = Serial.parseInt(); - Serial.flush(); + while (Serial.available()) Serial.read(); radio.frequency(freq); Serial.print("set frequency: "); Serial.println(freq); diff --git a/examples/HandyTalkie/HandyTalkie.ino b/examples/HandyTalkie/HandyTalkie.ino index 96b53f6..b54761b 100644 --- a/examples/HandyTalkie/HandyTalkie.ino +++ b/examples/HandyTalkie/HandyTalkie.ino @@ -135,7 +135,7 @@ void loop() { } else { Serial.setTimeout(40); freq = Serial.parseInt(); - Serial.flush(); + while (Serial.available()) Serial.read(); radio.frequency(freq); Serial.print("set frequency: "); Serial.println(freq);