peek()
描述
从序列埠收到并放在缓冲区的资料中,取得下次呼叫 read()
会得到的值。使用这个函式并不会减少缓冲区的资料总数,换句话说,透过 peek()
成功取得值后,下次用 read()
也会得到相同的值。
peek()
是继承于 Stream 类别。
语法
适用所有板子:
Serial.peek()
Serial1.peek()
适用 86Duino ONE:
Serial2.peek()
Serial3.peek()
Serial485.peek()
适用 86Duino EduCake:
Serial2.peek()
Serial3.peek()
Serial232.peek()
参数
回传
在缓冲区内第一个可用的 byte (假如缓冲区内没有值,则回传 -1) int 型别
See also
- Serial
- available()
- begin()
- end()
- find()
- findUntil()
- flush()
- parseFloat()
- parseInt()
- print()
- println()
- read()
- readBytes()
- readBytesUntil()
- setTimeout()
- write()
- serialEvent()
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.