SoftwareSerial: isListening()
描述
检查软体序列介面是否被监听中。
语法
mySerial.isListening()
参数
无参数
回传
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.isListening()) {
Serial.println("Port One is listening!");
}
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.
