diff --git a/IRremote.h b/IRremote.h index 3a64fed..da93648 100644 --- a/IRremote.h +++ b/IRremote.h @@ -172,6 +172,7 @@ class IRrecv void blink13 (int blinkflag) ; int decode (decode_results *results) ; void enableIRIn ( ) ; + bool isIdle ( ) ; void resume ( ) ; private: diff --git a/examples/IRsendDemo/IRsendDemo.ino b/examples/IRsendDemo/IRsendDemo.ino index e3772ed..80e37f2 100644 --- a/examples/IRsendDemo/IRsendDemo.ino +++ b/examples/IRsendDemo/IRsendDemo.ino @@ -8,15 +8,14 @@ #include -IRsend irsend; +IRrecv irrecv; void setup() { + Serial.begin(115200); } void loop() { - for (int i = 0; i < 3; i++) { - irsend.sendSony(0xa90, 12); // Sony TV power code - delay(40); - } + if (irrecv.isIdle()) + Serial.println("Idling"); } diff --git a/irRecv.cpp b/irRecv.cpp index 4614020..a6fafe2 100644 --- a/irRecv.cpp +++ b/irRecv.cpp @@ -133,6 +133,13 @@ void IRrecv::blink13 (int blinkflag) if (blinkflag) pinMode(BLINKLED, OUTPUT) ; } +//+============================================================================= +// Return if receiving new IR signals +// +bool IRrecv::isIdle ( ) +{ + return (irparams.rcvstate == STATE_IDLE || irparams.rcvstate == STATE_STOP) ? true : false; +} //+============================================================================= // Restart the ISR state machine //