Hi,
I'm just starting out with arduino and I'm messing around with an IR receiver, a remote control, and two LED lights. I'm trying to get one of the lights to go on for a second when I press the "1" (IR HEX code=FD08F7) button and the other one when I press the "2" button (IR HEX code=FD8877). I'm using a library called IRremote.h that I found here:
http://www.pjrc.com/teensy/td_libs_IRremote.htmlSo far only one of the lights works when press ANY button on the remote (so not only the "1" button, as it supposed to do)
Here's my code
#include <IRremote.h>
const int RECV_PIN = 3;
int led1 = 8;
int led2 = 9;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
if (results.value = 0xFD08F7) {
digitalWrite(led1, HIGH);
delay(1000);
digitalWrite(led1, LOW);
}
else if (results.value = 0xFD8877) {
digitalWrite(led2, HIGH);
delay(1000);
digitalWrite(led2, LOW);
}
irrecv.resume();
}
}
If somebody could take a look at it and help me, I would really appreciate it