mirror of
https://github.com/Theaninova/Arduino-IRremote.git
synced 2025-12-13 01:46:21 +00:00
added isIdle Method for receiving, #48
This commit is contained in:
@@ -172,6 +172,7 @@ class IRrecv
|
|||||||
void blink13 (int blinkflag) ;
|
void blink13 (int blinkflag) ;
|
||||||
int decode (decode_results *results) ;
|
int decode (decode_results *results) ;
|
||||||
void enableIRIn ( ) ;
|
void enableIRIn ( ) ;
|
||||||
|
bool isIdle ( ) ;
|
||||||
void resume ( ) ;
|
void resume ( ) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -8,15 +8,14 @@
|
|||||||
|
|
||||||
#include <IRremote.h>
|
#include <IRremote.h>
|
||||||
|
|
||||||
IRsend irsend;
|
IRrecv irrecv;
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
for (int i = 0; i < 3; i++) {
|
if (irrecv.isIdle())
|
||||||
irsend.sendSony(0xa90, 12); // Sony TV power code
|
Serial.println("Idling");
|
||||||
delay(40);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,6 +133,13 @@ void IRrecv::blink13 (int blinkflag)
|
|||||||
if (blinkflag) pinMode(BLINKLED, OUTPUT) ;
|
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
|
// Restart the ISR state machine
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user