Arduino Serial Monitor, Serial monitor, serial monitor in arduino, arduino serial flush
Hello 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 going to 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 going to 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 going to be my last lecture on Arduino Serial Port because I have covered it in full detail. Although I am going to summarize all the Arduino Serial Post Commands 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:

Where To Buy?
No.ComponentsDistributorLink To Buy
1Arduino UnoAmazonBuy Now

How to use Arduino Serial Flush?

  • Arduino Serial Flush is used to flush the data sent through Arduino Serial Port.
  • 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 refreshes it and also makes you ready to send the next data.
  • Here's the syntax to use the 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 that clears the data on the 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 the 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 !!! :)