Arduino Serial Flush

In this tutorial, we will discuss how we can check if the serial transmission is done or not using the Serial.flush() function in Arduino.

Check if the Serial Transmission Is Done or Not Using the Serial.flush() Function in Arduino

When we transmit data from serial, the data is placed in a buffer, and the program moves to the next statement, and the data is transmitted slowly from the buffer because serial is slow. If you don’t want the program to move forward until the transmission is finished, you can use the Serial.flush() function to make sure all of the data is transmitted and the buffer is empty now. Using this function, your program will not move forward until the serial transmission is done.

void setup(){
void loop(){

In the above code, we are printing a string on the serial monitor, and then we are checking if the serial transmission is done or not. If it’s done, the program will move forward to the next statement.

Related Article - Arduino Serial

  • Arduino Clear Serial Buffer
  • Baud Rate in Arduino Serial Communication
  • Arduino Serial Port Read String