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.