I'm having an issue with setting up an IR receiver. I borrowed some code, but it basically prints out what the IR receiver sees.
The problem I'm having is that the when I press a button on the remote, nothing appears in the serial monitor. After a few minutes, some codes do appear, but my expectation is that they should appear almost instantly and they don't seem to appear consistently.
To isolate the variables, I've tried different remotes, different arduino boards and different ir receivers, and even a few different sketch and still same results. Here is the code I'm using:
/*
// Include IR Remote Library by Ken Shirriff
#include <IRremote.h>
// Define sensor pin
const int RECV_PIN =11;
// Define IR Receiver and Results Objects
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
// Serial Monitor @ 9600 baud
Serial.begin(9600);
// Enable the IR Receiver
irrecv.enableIRIn();
}
void loop(){
if (irrecv.decode(&results)){
// Print Code in HEX
Serial.println(results.value, HEX);
irrecv.resume();
}
}
My setup is straight forward - 5v from board to 5v in the IR receiver, data to pin 11 and ground to ground:
Any help would be appreciated.