#define DECODE_NEC            // DECODE_NEC
#include <IRremote.hpp>       // Do not change header order.

constexpr uint8_t RECV_PIN {2};
constexpr uint8_t LED {12};

constexpr uint16_t S1 = 0x38;  // Taste 5

uint16_t irReceive() {
  uint16_t received{0};
  
  if (IrReceiver.decode()) {
    IrReceiver.printIRResultShort(&Serial);
    if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
      // We have an unknown protocol here, print more info
      IrReceiver.printIRResultRawFormatted(&Serial, true);
    }
    if (IrReceiver.decodedIRData.protocol == NEC) {
      received = IrReceiver.decodedIRData.command;
      Serial.print("Command: 0x");
      Serial.println(received, HEX);
    }
    IrReceiver.resume();
  }
  return received;
}

void setup()
{
  Serial.begin(9600);

  pinMode (LED, OUTPUT); 
  digitalWrite (LED, HIGH);

  IrReceiver.begin(RECV_PIN);
  Serial.print(F("Ready to receive IR signals at pin "));
  Serial.println(RECV_PIN);
}

void loop()
{
   if (irReceive() == S1) { digitalWrite(LED,!digitalRead(LED)); }
}
Taste 5 schaltet die LED Aus/Ein
nano:12
nano:11
nano:10
nano:9
nano:8
nano:7
nano:6
nano:5
nano:4
nano:3
nano:2
nano:GND.2
nano:RESET.2
nano:0
nano:1
nano:13
nano:3.3V
nano:AREF
nano:A0
nano:A1
nano:A2
nano:A3
nano:A4
nano:A5
nano:A6
nano:A7
nano:5V
nano:RESET
nano:GND.1
nano:VIN
nano:12.2
nano:5V.2
nano:13.2
nano:11.2
nano:RESET.3
nano:GND.3
ir1:GND
ir1:VCC
ir1:DAT
led1:A
led1:C
r1:1
r1:2
gnd1:GND