#include <IRremote.h>

//connection declaration
#define LED_PIN 3
#define IRRECV_PIN 4

//IR receiver object creation
IRrecv receiver(IRRECV_PIN);

int led_value = LOW;


void setup() {
  // put your setup code here, to run once:

  //pinmode settings
  pinMode(IRRECV_PIN, INPUT);  
  pinMode(LED_PIN, OUTPUT);

  //enable the receiver
  receiver.enableIRIn();

  digitalWrite(LED_PIN, led_value);
}

void loop() {
  // put your main code here, to run repeatedly:
  if(receiver.decode()){
    transIRRM();
    // Receive the next value
    receiver.resume();}
  
  digitalWrite(LED_PIN, led_value);

}

void transIRRM() {
  if(receiver.decodedIRData.command == 162){
    led_value = !led_value;
  }

}