[solved] Serial print: when is it finished / queue is empty.

Hello,

my arduino sends some bytes and it is working fine (with serial.print (Hardware Uart)). I want to repeat the String as fast as possible. But I don't want to fill the queue.

Is there a flag, that signals "sending the Sting finished"? Or can i get the remaining bytes in the queue?

Thank you.

Snowyrain

This blocks until the serial transmit buffer is empty.

Serial.flush();

Look at Serial.availableForWrite()

Hello and thank you!

//Only send data when serial-queue is completely empty
if(Serial.availableForWrite() >= SERIAL_TX_BUFFER_SIZE-1 ){
Serial.print("SOMETHING");
}

Have a nice day.

Snowyrain

What are you communicating with? What baud rate are you using? An Arduino can usually work at 500,000 baud if you need high throughput.

On the other hand I would be surprised if there isn't a better alternative to repeating a message as often as possible.

...R