I want to test my Elegoo IR Remote, and with the default .ino file, I'm getting weird results.
I don't know if this is an issue with the remote itself or something in the code (that came with my Elegoo kit).
When I press the POWER button, each time it gives one of several results:
results.value = FFA25D (this is what I want, corresponds correctly)
results.value = FFFFFFFF (this is fine, just showing the button repeated)
results.value = E318261B (this is not correct, and I have no idea why it's showing that)
results.value = FF (what the heck)
Anyone know why the same button would show multiple results, where the correct result is the one that comes up the least?
Here's the code:
#include <IRremote.h>
#include <IRremoteInt.h>
//www.elegoo.com
//2020.3.12
#include "IRremote.h"
IRrecv irrecv(11); // create instance of 'irrecv'
decode_results results; // create instance of 'decode_results'
String remote_code = "";
void translateIR() {
switch(results.value)
{
case 0xFFA25D: remote_code = "POWER"; break;
default: remote_code = "other button";
}// End Case
Serial.print(remote_code);
Serial.print(", ");
Serial.print(results.value, HEX);
}
void setup() {
Serial.begin(9600);
Serial.println("IR Receiver Button Decode");
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results)) // have we received an IR signal?
{
translateIR();
delay(500);
irrecv.resume(); // receive the next value
}
}