#include <IRremote.h>
// IR decoder or receiver connected at pin 11
const byte recv_pin = 11;
// let's make a object of receiver class
IRrecv receiver(recv_pin);
void setup(){
Serial.begin(9600);
// lets enable/start the receiver
receiver.enableIRIn();
// built led at pin 13 blinks, whenever we receive a code successfully
// helpful for debugging
receiver.blink13(true);
}
void loop(){
// decode method looks for IR signals, and if rececived, decodes them
if (receiver.decode()){
// call action method
int response = receiver.decodedIRData.command;
action(response);
// get ready to catch next command
receiver.resume();
}
// to improve simulator working
delay(10);
}
void action(int num){
// Serial.println(num);
if (num == 162)Serial.println("POWER button is pressed");
else if (num == 226)Serial.println("MENU button is pressed");
else if (num == 34)Serial.println("TEST button is pressed");
else if (num == 2)Serial.println("VOLUME UP button is pressed");
else if (num == 194)Serial.println("BACK button is pressed");
else if (num == 224)Serial.println("PREVIOUS button is pressed");
else if (num == 168)Serial.println("PLAY / PAUSE button is pressed");
else if (num == 144)Serial.println("NEXT button is pressed");
else if (num == 104)Serial.println("0 button is pressed");
else if (num == 152)Serial.println("VOLUME DOWN button is pressed");
else if (num == 176)Serial.println("APPS button is pressed");
else if (num == 48)Serial.println("1 button is pressed");
else if (num == 24)Serial.println("2 button is pressed");
else if (num == 122)Serial.println("3 button is pressed");
else if (num == 16)Serial.println("4 button is pressed");
else if (num == 56)Serial.println("5 button is pressed");
else if (num == 90)Serial.println("6 button is pressed");
else if (num == 66)Serial.println("7 button is pressed");
else if (num == 74)Serial.println("8 button is pressed");
else if (num == 82)Serial.println("9 button is pressed");
}