#include <IRremote.h>
#define PIN_RECEIVER 2 // Signal Pin of IR receiver
IRrecv receiver(PIN_RECEIVER);
void setup()
{
Serial.begin(9600);
receiver.enableIRIn(); // Start the receiver
}
void loop()
{
// Checks received an IR signal
if (receiver.decode()) {
translateIR();
receiver.resume(); // Receive the next value
}
}
void translateIR()
{
// Takes command based on IR code received
switch (receiver.decodedIRData.command) {
case 162:
Serial.println("162 button");
break;
case 226:
Serial.println("226 button");
break;
case 34:
Serial.println("34 button");
break;
case 2:
Serial.println("2 button");
break;
case 194:
Serial.println("194 button");
break;
case 224:
Serial.println("224 button");
break;
case 168:
Serial.println("168 button");
break;
case 144:
Serial.println("144 button");
break;
case 104:
Serial.println("104 button");
break;
case 152:
Serial.println("152 button");
break;
case 176:
Serial.println("176 button");
break;
case 48:
Serial.println("148 button");
break;
case 24:
Serial.println("124 button");
break;
case 122:
Serial.println("122 button");
break;
case 16:
Serial.println("16 button");
break;
case 56:
Serial.println("56 button");
break;
case 90:
Serial.println("90 button");
break;
case 66:
Serial.println("66 button");
break;
case 74:
Serial.println("74 button");
break;
case 82:
Serial.println("82 button");
break;
default:
Serial.print(" other button");
}
}