Mister Mystère
Mister Mystère

Reputation: 1002

How to detect whether Arduino's Serial is transmitting?

Some of my sketch is outputting the content of a file on an SD card into the serial monitor. However, this file can be long and at the end of the loop I put the Arduino in a deep hibernation state for several minutes which cuts any transmission of data.

I can't really set any delay to wait for before the hibernation (since the size of the file varies), so I would like to know if there is a way to know whether the Serial is transmitting or not (some kind of busy or buffer empty flags).

Upvotes: 0

Views: 135

Answers (1)

Mister Mystère
Mister Mystère

Reputation: 1002

Silly me, Serial.flush() does just that: wait for the buffer to empty. Resolved!

Upvotes: 1

Related Questions