IR Receiver reading only 0's

Hi, I am using an IR Receiver that I've got from Elegoo super starter kit. I am also using an Arduino Uno .I've used this code to decode it to HEX format:

#include <IRremote.h>

const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;

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

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

All I get in the serial monitor (9600 baud rate) is 0. I've tried everything including checking if it was dead but it still displayed 0's. Just incase I used my 2nd IR Receiver from my Elegoo sensor kit but yet that also posted 0's. I've searched all over and use every code i could get my hands on but yet it didn't work. I've even tried using an Arduino Nano, esp8266, Elegoo Arduino Uno &, off branded Nano. I even bought more IR Receivers but they don't work ether...
links:
Elegoo super starter kit:

Elegoo sensor kit:

IR Receiver:
https://www.amazon.ca/Gikfun-Infrared-Emission-Receiver-Electronic/dp/B07FFQ9B9H/ref=sr_1_1_sspa?crid=1IZE1GOSPN3ZA&dchild=1&keywords=ir+receiver&qid=1611691825&sprefix=ir+re%2Caps%2C323&sr=8-1-spons&psc=1&spLa=ZW5jcnlwdGVkUXVhbGlmaWVyPUE0QUwxN05WV1JJWFImZW5jcnlwdGVkSWQ9QTA3MTMzMzYxNTg1VllIUFlDWDVGJmVuY3J5cHRlZEFkSWQ9QTA2MjM1NTIzNUM2VFQyVVo1RDNLJndpZGdldE5hbWU9c3BfYXRmJmFjdGlvbj1jbGlja1JlZGlyZWN0JmRvTm90TG9nQ2xpY2s9dHJ1ZQ==

I'VE FOUND A SOLUTION!

Turns out this code is a working code:

#include <IRremote.h> //Make sure to install the library
int IRpin=9;
IRrecv IR(IRpin);
decode_results cmd;
String myCom;
void setup()
{
Serial.begin(9600);
IR.enableIRIn();
}
 
void loop() {
  while (IR.decode(&cmd)==0){ 
}
Serial.println(cmd.value,HEX);
delay(1500);
IR.resume();
 
if (cmd.value==0xFF6897){
  myCom="zero";
  Serial.println(myCom); 
}
if (cmd.value==0xFFA25D){
  myCom="pwr";
  Serial.println(myCom); 
}
 
}

But I did install the wrong Library . Turns out I needed to get an older version because the newest version of this libeary is different. I downloaded the 2.2.3 version and it worked!

Here is the link to the Library you should download instead:

Or just download it directly here.

Thank you SO MUCH for this solution. I have been banging my head against the wall trying to get something beside "0". The older version of IRreceiver worked great ! ! ! ! !

The older (and newest) versions of the IRremote library are available through the IDE library manager. Always use the library manager to install libraries, if possible.

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