SoftwareSerial: overflow()
描述
检查软体序列介面的缓冲区(buffer)是否溢位(overflow)。呼叫这个函式会清除溢位的旗标(flag),意指除非在呼叫后有新的资料到来,否则再呼叫这个函式会得到 false。
软体序列介面的缓冲区(buffer)的大小是 64 个位元组。
语法
mySerial.overflow()
参数
无参数
回传
boolean:如果缓冲区溢位则回传 true,反之回传 false
范例
#include <SoftwareSerial.h>
// 创建新的软体序列介面,TX 在数位脚位 10,RX 在数位脚位 11
SoftwareSerial portOne(10,11);
void setup()
{
// 启动硬体序列介面
Serial.begin(9600);
// 启动软体序列介面
portOne.begin(9600);
}
void loop()
{
if (portOne.overflow()) {
Serial.println("SoftwareSerial overflow!");
}
See also
- SoftwareSerial()
- read()
- print()
- println()
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.
