Hi,
I recently started to play with my IR receiver. Using Ken Shirriff's IR library i tried to read simple HEX codes from the IR remote control i got with the arduino kit.
Problem is, whenever i start the program i keep getting random readings regardless of whether i m pressing a button or not.
Any ideas whats the source of this and how i can get only the readings from a remote control?
here is the code i m using (example from the library): #include <IRremote.h>
int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
irrecv.resume(); // Receive the next value
}
}
It has some 'quite' periods and then i can see codes that match the buttons i press on the remote. So the remote is definitely working. Also, i tried my TV and AC remotes and they both gave consistent codes when i pressed the same button over and over.
Bright light can cause these receivers to spit out garbage; add some kind of shade to it. You'll also want to add a .1uF cap between the 5V and GND pins on the receiver (as close to the receiver as possible) and a 100 ohm resistor on its 5V line. That will help clean up noisy power.