I have a MEGA 2560 and I am doing some programming in a school program as part of a science club. I bought a duinotech kit with a remote and IR sensor. Having read some blogs on the topic, I have tried 2 different approaches to determine the hexcodes related to different buttons on the IR remote. However, I can't seem to get it to work at all.
The only time a code appears is when I unplug one of the cords, and even then it displays about 6 different 8-digit codes. I have attached 2 different versions of code that I found for attempting to retrieve the hexcodes
#include <IRremote.h>
const int RECV_PIN = 7;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup(){
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
Serial.println(results.value, HEX);
irrecv.resume();
}
}
#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();
}
}