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:
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:
#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:
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.