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.