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.