Serial.setTimeout()

Description

Serial.setTimeout() sets the maximum milliseconds to wait for serial data. It defaults to 1000 milliseconds.

Serial.setTimeout() inherits from the Stream utility class.

Syntax

Serial.setTimeout(time)

Parameter Values

  • Serial: serial port object. See the list of available serial ports for each board on the Serial main page.
  • time: timeout duration in milliseconds. Allowed data types: long.

Return Values

  • Nothing

※ NOTES AND WARNINGS:

Serial functions that use the timeout value set via Serial.setTimeout():

  • Serial.find()
  • Serial.findUntil()
  • Serial.parseInt()
  • Serial.parseFloat()
  • Serial.readBytes()
  • Serial.readBytesUntil()
  • Serial.readString()
  • Serial.readStringUntil()

See Also

Please note: These are affiliate links. If you buy the components through these links, We may get a commission at no extra cost to you. We appreciate it.