mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-11 08:56:14 +00:00
added isIdle Method for receiving, #48
This commit is contained in:
@@ -172,6 +172,7 @@ class IRrecv
|
||||
void blink13 (int blinkflag) ;
|
||||
int decode (decode_results *results) ;
|
||||
void enableIRIn ( ) ;
|
||||
bool isIdle ( ) ;
|
||||
void resume ( ) ;
|
||||
|
||||
private:
|
||||
|
||||
@@ -8,15 +8,14 @@
|
||||
|
||||
#include <IRremote.h>
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
@@ -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
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user