#include <IRremote.h>
int led_pin = 3;
int pin_receiver = 2;
int button_value = 0;
IRrecv receiver(pin_receiver);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
receiver.enableIRIn();
}
void loop() {
// put your main code here, to run repeatedly:
if (receiver.decode()) {
translateIR();
receiver.resume();
}
}
int translateIR()
{
button_value = receiver.decodedIRData.command;
Serial.println("button_value: ");
Serial.println(button_value);
if (button_value = 162) {
Serial.println("POWER");
digitalWrite(led_pin, LOW);
}if (button_value = 226) {
Serial.println("Menu");
Serial.println("Press TEST to turn on the led");
Serial.println("Press POWER to turn off the led");
Serial.println("Press one to blink the led");
}if (button_value = 34) {
Serial.println("TEST");
digitalWrite(led_pin, HIGH);
}if (button_value = 48) {
Serial.println("one");
digitalWrite(led_pin, HIGH);
delay(300);
digitalWrite(led_pin, LOW);
delay(300);
digitalWrite(led_pin, HIGH);
delay(300);
digitalWrite(led_pin, LOW);
}
}