Ir receiver showing different values

When I press a button on my IR remote, the IR receiver gets 0xffffffff and when I put my hand in front of it, the IR receiver detects different values when I press the same button.

#include <IRremote.h>
#include <LiquidCrystal_I2C.h>

const int RECV_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;
LiquidCrystal_I2C lcd(0x27, 16, 2);
int i = 0;

void setup(){
  Serial.begin(9600);
  irrecv.enableIRIn();
  irrecv.blink13(true);
  lcd.init();
  lcd.begin(16,2);
  lcd.backlight();
}

void loop(){
  if (irrecv.decode( &results ))
   {
      unsigned long IRval = results.value;
      if (IRval == 0xffffffff)
      {
         irrecv.resume();
         return;
      }
      lcd.clear();
      Serial.println( results.value, HEX );
      lcd.print(i);
      lcd.print(": ");
      lcd.print(results.value, HEX);
      i++;
      irrecv.resume();
   }
  }

I made it so it shows the values different of 0xffffffff on an I2C lcd.

Cool.

1 Like

UPDATE: When I put the remote under table, the receiver activates :slight_smile: .

1 Like

Is the receiver compatiable with the transmiter?
Is the receiver connected properly to the Arduino?
Which Arduino?

1 Like

The receiver’s led blink when I press a button on my remote. I tried with different cables to connect the s to different digital pins and I use Arduino Uno r3

What version of the IRremote library do you have installed? The posted code was written for an older (than current) version so may not work right with the newer versions of the library.

If you enable compiler warnings in the IDE at File, Preferences you will see a warning when compiling older code.

image

1 Like

I don't know how to access the preferences, but when I search the library it shows that the version installed is 4.1.2.

image

COOL. You discoverd the physical phenomenon called NOISE!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.