Serial.setTimeout()
描述
Serial.setTimeout()
可以设定序列埠接收资料时的最大等待时间 (以毫秒为单位),超过这个时间没有接收到任何资料,则判定为超时。可以应用在例如:Serial.readBytesUntil()
或 Serial.readBytes()
。预设值是 1 秒。
Serial.setTimeout()
是继承于 Stream 类别。
语法
Serial.setTimeout(time)
参数
time
: 等待资料进来的最大时间 (单位:毫秒,long 型别)
回传
无回传值
See also
- Serial
- Stream
- Stream.setTimeout()
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.