|Top Previous Next|
Gets or sets the maximum time to wait for receive data.
The maximum time, in milliseconds, for the read function to wait for receive data.
The default value for this property is zero, meaning the read function will return immediately with only data that was already in the receive buffer. The maximum value is around 60,000, or one minute, except that the property may also be set to the value Infinity (or +Infinity). In the latter case the read function will block execution indefinitely until the requested number of bytes is received.
// Wait up to 2 seconds until a 4-byte message received
// Much simpler than example for bytesCanRead
val = Cell.Serial.read(4);
if (val.length < 4)
; // timeout
// Disable timeout
Cell.Serial.readTimeout = Infinity;
val = Cell.Serial.read(1);