IR communication not consistent I have an IR Receiver hooked up to my arduino and a remote with an IR Trasmitter in it. I have some code to decode the values that are received but the values change even when I am pressing the same button!

Here is the code I am using:

#include &lt;IRremote.h&gt;

int IRpin = 8;
IRrecv irrecv(IRpin);
decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn();
}

void loop() 
{
  if (irrecv.decode(&amp;results)) 
    {
      Serial.println(results.value, HEX);
      irrecv.resume();
    }  
}


and here is me pressing the same button 10 times and the output for it:


  9C01C8E1
  FFFFFFFF
  82A6A14C
  FFFFFFFF
  FFFFFFFF
  70D67871
  FFFFFFFF
  BCB5C227
  FFFFFFFF
  B358F5ED
  FFFFFFFF
  FFFFFFFF
  FFFFFFFF
  FFFFFFFF
  FFFFFFFF
  FFFFFFFF
  58EE9A27
  FFFFFFFF
  90750A0D
  FFFFFFFF
  FFFFFFFF
  FFFFFFFF
Get TSOP1738 or any good IR receiver to decode. Above code is appropriate and does not need any changes. you will surely get some fluctuations and different decoded hex codes but it would provide only 2 different values for single button so that while controlling any device using ir , you can use 'or' operator in conditional statement and hence you will get desired results.
Getting absolute results from a cheap IR receiver is a myth.But it will work well for your project at lower level.I had worked with that and my device is working in my room with no difficulty.