Serial.flush();
- Arduino Clear Serial
- Arduino Clear Serial Port
- Arduino Clear Serial Output
- Arduino Clear Serial Monitor
- Arduino Clear Serial Monitor
while(Serial.available());- In the above code I have simply added the Arduino Serial Flush code and now it will take a little more time to complete because now it will make sure that all the data has been sent.
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB:

Syed Zain Nasir
Arduino Clear Serial
Output: in Serial buffer=0 OK found in Serial buffer=1 b left in serial buffer in Serial buffer=0 waited too long nothing received. After OK is found serialflush is executed but after second run there serial.available shows there is something in serial buffer. Right at that moment it was char 'b' but it also can show char 'd' and 'c. Also, there is an app in the play store called 'Serial USB Terminal' by Kai Morich. With this app you can quickly and easily test your serial parameters from your phone to device to make sure it is working properly. For example, with the arduino connected running the above sketch, entering a '1' into this app returns a '4' on the terminal.
@syedzainnasirArduino Clear Serial Port
I am Syed Zain Nasir, the founder of The Engineering Projects (TEP).I am a programmer since 2009 before that I just search things, make small projects and now I am sharing my knowledge through this platform.I also work as a freelancer and did many projects related to programming and electrical circuitry. My Google Profile+
FollowArduino Clear Serial Output
Get Connected