Hi,
I have a project where I need to control a LED strip via IR.
What I have done so far is read the IR signals from the remote control using this code:
#include <IRremote.h>
const int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
irrecv.blink13(true);
}
void loop() {
if (irrecv.decode(&results)) {
if (results.decode_type == NEC) {
Serial.print("NEC: ");
} else if (results.decode_type == SONY) {
Serial.print("SONY: ");
} else if (results.decode_type == RC5) {
Serial.print("RC5: ");
} else if (results.decode_type == RC6) {
Serial.print("RC6: ");
} else if (results.decode_type == UNKNOWN) {
Serial.print("UNKNOWN: ");
}
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}
On the serial monitor I could clearly see input.
This is an example:
NEC: F7A857
NEC: FFFFFFFF
NEC: F7609F
NEC: FFFFFFFF
NEC: F750AF
NEC: FFFFFFFF
It looks like each time it received a code like NEC: F750AF
Then followed by NEC: FFFFFFFF
Initially I figured NEC: FFFFFFFF might just be an error.
So I tried sending the IR signal using:
#include <IRremote.h>
IRsend irsend;
void setup()
{
}
void loop() {
for (int i = 0; i < 3; i++) {
irsend.sendNEC(0xF750AF, 32);
delay(40);
}
delay(5000); //5 second delay between each signal burst
}
But the LED strip didnt change colour.
Then I changed it a bit so it also sends the 0xFFFFFFFF
for (int i = 0; i < 3; i++) {
irsend.sendNEC(0xF750AF, 32);
delay(10);
irsend.sendNEC(0xFFFFFFFF, 32);
delay(40);
}
This is also not working.
I tried changing 32 bit to I think any possible number but it just wont change colour.
And yes, I know I revieved F750AF when I pressed the button for pink, so I changed the LED strip colour before sending it.
I am not quite new to this.
Any suggestions that may help ?
I am using a IR reciever and a IR Led that are on a small board.
I know the IR signal wire is going to the correct pin on the arduino.
I can see the IR LED flash when I look trough my phone's camera on it. (if that makes sense)