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.