Serial.readBytes()
描述
Serial.readBytes()
可以把收到 (在緩衝區內) 的字元放到指定的陣列中,直到符合指定的長度或是超過一段時間 (時間的設定請參考 Serial.setTimeout()).
Serial.readBytes()
會回傳在緩衝區中的字元總數。假如緩衝區內沒有可用的值時,將回傳 0。
Serial.readBytes()
是繼承於 Stream 類別。
語法
Serial.readBytes(buffer, length)
參數
buffer
: 儲存資料的陣列 (char[] or byte[] 型別)
length
: 要讀取的 byte 總數 (int 型別)
回傳
byte
See also
- Stream
- Stream.readBytes()
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.