我想找...

搜尋

分享

目錄

SoftwareSerial: overflow()

[SoftwareSerial]

描述

Tests to see if a software serial buffer overflow has occurred. Calling this function clears the overflow flag, meaning that subsequent calls will return false unless another byte of data has been received and discarded in the meantime.

The software serial buffer can hold 64 bytes.

語法

// set up a new serial port
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

mySerial.overflow()

參數

回傳

boolean

範例

#include <SoftwareSerial.h>
 
// software serial : TX = digital pin 10, RX = digital pin 11
SoftwareSerial portOne(10,11);
 
void setup()
{
  // Start the hardware serial port
  Serial.begin(9600);
 
  // Start software serial port
  portOne.begin(9600);
}
 
void loop()
{
  if (portOne.overflow()) {
   Serial.println("SoftwareSerial overflow!"); 
}

參考


函式庫參考主頁面

86Duino 參考的文本是根據 Creative Commons Attribution-ShareAlike 3.0 License,部分文本是從 the Arduino reference 修改的。 參考中的代碼示例已發佈到公共領域。

返回頂端