Serial.readBytesUntil()

描述

Serial.readBytesUntil() 可以把收到 (在緩衝區內) 的字元放到一個指定的陣列中。這個函式會直到偵測到結尾字符、符合指定的長度或超過指定時間後停止 (時間的設定可參考 Serial.setTimeout())。

Serial.readBytesUntil() 會回傳在緩衝區中的字元總數。假如緩衝取內沒有可用的值時,將回傳 0。

Serial.readBytesUntil() 是繼承於 Stream 類別。

語法


Serial.readBytesUntil(character, buffer, length)

參數

character : 要尋找的結尾字符 (char 型別)
buffer : 儲存資料的陣列 (char[] or byte[] 型別)
length : 要讀取的 byte 總數 (int 型別)

回傳

byte

See also

Serial
Stream
Stream.readBytesUntil()


語法參考主頁面

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.