I am trying to get it when I push a button it outputs the hex results and the name of the key. I have this kind of working but it keeps putting out the name of the button nonstop.
I want it to be like
1234567
Power
but it is like.
1234567
Power
Power
Power
Over and over again. Not sure how to make it only put out the hex and Key name once.
#include <IRremote.h>
int RECV_PIN = 11;
int LED_PIN = 3;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
irrecv.enableIRIn(); //Start the IR receiver
}
void loop() {
// put your main code here, to run repeatedly:
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
if (irrecv.decode(&results)) {
Serial.println(results.value, HEX);
//Serial.println(results.value);
irrecv.resume();
//delay(1000);
}
delay(100);
keyPress();
}
void keyPress() {
switch (results.value){
case 0x4B790694: Serial.println("Power"); break;
case 0xA636698E: Serial.println("DVD"); break;
}
}