ogogon
1
Colleagues, please tell me the answer to my question!
I read the transmitted codes of several remote controls. Almost always, after real code, the library returns a value FFFFFFFF.
The program is very simple:
#include "IRremote.h"
IRrecv irrecv(2);
decode_results results;
void setup() {
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop() {
if ( irrecv.decode( &results )) {
Serial.println( results.value, HEX );
irrecv.resume();
}
}
What am I doing wrong and where does this FFFFFFFFF value come from?
Ogogon.
0xffffffff is the "repeat code" sent when a button is held down.
LarryD
3
When you hold the button down your IR remote sends the repeat code.
i.e. 0xFFFFFFFFF
This is an example of the code that I use when I want to ignore the repeat codes.
#include "IRremote.h"
IRrecv irrecv(2);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop()
{
readIR();
}
void readIR()
{
if (irrecv.decode( &results ))
{
unsigned long IRval = results.value;
if (IRval == 0xffffffff)
{
irrecv.resume();
return;
}
Serial.println( results.value, HEX );
irrecv.resume();
}
}