I am trying to send real-time data taken from an ADC by Arduino Uno (SPI) to Arduino IDE through a USB cable. I found that one byte takes around 70 microseconds when Serial.write() is used at a baud rate of 115200. My question is that if I send 14400 bytes (which would be the maximum limit at this baud rate), can I perform any other tasks? Does Arduino allow multitasking while the serial buffer is busy writing data?

  • why do you say that 14400 bytes is a limit?
    – jsotola
    Jan 28, 2019 at 21:01

1 Answer 1


Until you fill the transmit buffer (64 bytes by default but can be recompiled to enlarge it if you need to), Serial.print() or Serial.write() will return immediately. The characters in the buffer will be transmitted by an interrupt service routine, so essentially, the Arduino is double-tasking for that purpose. If the buffer is full when you call Serial.print() or Serial.write() or Serial.print() fills it before having sent all of its characters, those calls block (won't return) until there is buffer-space for their remaining characters.

So yes, you can do other things while the writing happens, as long as you haven't filled the buffer. You can call Serial.availableForWrite() to find out how many characters you can send without blocking.

By the way, at 115200 baud, or 11520 bytes/second, each character should take 1/11520 seconds or 86.8 microseconds, not 70 milliseconds.

  • Thanks @JRobert. I will use serial.available and find out the time periods taken by serial.write and then I will get back.
    – NavTuriya
    Jan 28, 2019 at 20:09
  • I think baud rate specifies bits per second. So, to write a byte, it should take 1/115200*8 seconds, which comes out to be around 70 microseconds which is what exactly I found. Sorry for the typo earlier, I wrote milliseconds by mistake.
    – NavTuriya
    Jan 28, 2019 at 20:25
  • But in fact, serial transmission takes 10 or 11 bits (1 start bit, 8 data bits and 1 or 2 stop-bits; 1 is most common) to send an 8 bit byte. So you need to divide by ten instead of by 8.
    – JRobert
    Jan 28, 2019 at 20:31
  • Yes you are right. I will recheck the time values.
    – NavTuriya
    Jan 28, 2019 at 20:38
  • JRobert said Serial.availableForWrite not Serial.available. They are totally different things.
    – Nick Gammon
    Jan 28, 2019 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.