#include <IRremote.h>
int IR_input = 8;
IRrecv IR_fly(IR_input);
void setup() {
IR_fly.begin(IR_input);
Serial.begin(9600);
// put your setup code here, to run once:
}
void loop() {
if (IR_fly.decode())
{
verify();
IR_fly.resume();
}
}
void verify()
{
switch(IR_fly.decodedIRData.command)
{
case 162:
monitor("POWER");
break;
case 226:
monitor("MENU");
break;
case 34:
monitor("TEST");
break;
case 2:
monitor("OTHER");
break;
}
}
void monitor(char* button_name)
{
Serial.print(button_name);
Serial.println("button is pressed");
Serial.print("code:");
Serial.println(IR_fly.decodedIRData.command);
}