#include <IRremote.h>

// Pin configuration
const int ledPin = 13; // Change this to the desired pin for your LED
const int irReceiverPin = 2;

// Define the power on/off IR codes from your remote
unsigned long powerOnCode = 0xXXXXXXXX; // Replace with the actual code for power ON
unsigned long powerOffCode = 0xXXXXXXXX; // Replace with the actual code for power OFF

IRrecv irReceiver(irReceiverPin);
decode_results results;

void setup() {
  pinMode(ledPin, OUTPUT);
  irReceiver.enableIRIn();
}

void loop() {
  if (irReceiver.decode(&results)) {
    // If the IR receiver receives a signal, print the HEX code for debugging
    // Uncomment the following line to print the HEX codes
    // Serial.println(results.value, HEX);

    // Check if the received code matches the power ON code
    if (results.value == powerOnCode) {
      digitalWrite(ledPin, HIGH); // Turn ON the LED
    }
    
    // Check if the received code matches the power OFF code
    if (results.value == powerOffCode) {
      digitalWrite(ledPin, LOW); // Turn OFF the LED
    }

    irReceiver.resume(); // Receive the next IR signal
  }
}