Arduino Serial Monitor, Serial monitor, serial monitor in arduino, arduino serial flushHello friends, I hope you all are fine and having fun with your lives. Today, I am going to share a very quick and basic tutorial in which I will show you How to use Arduino Serial Flush. I hope you guys are gonna like it. We have seen How to use Arduino Serial Write ? In that tutorial we have sent some data over the Serial Port so you must recall that tutorial because we are gonna use the same example today. Moreover, it’s also good if you have a look at How to use Arduino Serial Monitor because that’s also related.

Moreover, I hope that’s gonna be my last lecture on Arduino Serial Port because I have covered it in full detail. Although I am gonna summarize all the Arduino Serial Posts in a single Post. You should also have a look at How to do Arduino Serial communication, because in that tutorial, I have combined all Arduino Serial Projects. Anyways, let’s get started with How  to use Arduino Serial Flush:

How to use Arduino Serial Flush ?

  • Arduino Serial Flush is used to flush the data send through Arduino Serially.
  • When we send data on a serial port through arduino then we use the command Serial.print or Serial. write.
  • So when the data is sent it is sent using interrupt and when we use Arduino Serial Flush command then it makes sure that all the data is sent through serial port and nothing’s left in the stream.
  • In simple words, it clears the serial data stream and kind of refresh it and also makes you ready to send next data.
  • Here’s the syntax to use Arduino Serial Flush command:


  • It doesn’t return anything that’s why we haven’t assigned any variable to it.
  • It’s just a simple function which clears the data on transmitting pin of Arduino.
  • Now, if you want to remove that on receiving pin of Arduino, then you just need to write this command:


  • But you make sure while using the above command because if you are receiving the data continuously then your code will remain stuck and won’t move forward unless you got the complete data.
  • So, here’s the small code which I have also used in the Arduino Serial Write tutorial but now I am using Arduino Serial Flush command too.
  • So, here’s the code:
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(13, 12, 11, 10, 9, 8);
void setup() {
  // set up the LCD's number of columns and rows:
  lcd.begin(20, 4);
  // Print a message to the LCD.
 // lcd.clear();
void loop() 
  • 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.

So, that’s all for today. I hope you guys have enjoyed this short Arduino Serial Flush tutorial. If you have any questions, please ask in the comments. Take care !!! 🙂

Leave a Reply