

Instead of waiting until the string has been transmitted, print() sets up a buffer for the string, and then is transmitted via interrupts one character at a time. Something you may not realize is that when you issue a Serial.print(), that function returns almost immediately. Serial.print() / Transmits Are Interrupt Based It pauses your program while the transmit buffer is flushed.

Serial.flush() doesn’t empty the “incoming” buffer as many people think. Waits for the transmission of outgoing serial data to complete. It doesn’t help that it’s functionality changed when version 1.0 of the Arduino IDE was released.ĭoes Serial.flush() affect the Transmit Buffer or the Receive Buffer and when do you need to use it?įrom the Arduino reference for Serial.flush (found on this page): In the Arduino library, the Serial object has a method called “flush().” Often users go throwing it into programs without fully understanding what it does.
