#define DECODE_NEC            // DECODE_NEC
// #include "PinDefinitionsAndMore.h" // Set IR_RECEIVE_PIN for different CPU's
#include <TinyIRReceiver.hpp> // include the code
#include <TinyDebug.h>

#if !defined(STR_HELPER)
#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)
#endif


constexpr uint8_t RECV_PIN {0};
constexpr uint8_t LED {1};

constexpr uint16_t S1 = 0x38;  // Taste 5

uint16_t irReceive() {
  uint16_t received{0};
  if (TinyReceiverDecode()) {
    received = TinyIRReceiverData.Command;
    Debug.print("0x");Debug.println(received,HEX);
  }
  return received;
}

void setup()
{
  Debug.begin();

  pinMode (LED, OUTPUT);
  digitalWrite (LED, HIGH);
  // Enables the interrupt generation on change of IR input signal
  if (!initPCIInterruptForTinyReceiver()) {
    Debug.println(F("No interrupt available for pin " STR(IR_RECEIVE_PIN))); // optimized out by the compiler, if not required :-)
  }
  Debug.println(F("Ready to receive NEC IR signals at pin " STR(IR_RECEIVE_PIN)));
}

void loop()
{
  if (irReceive() == S1) {
    digitalWrite(LED, !digitalRead(LED));
  }
}

void handleReceivedTinyIRData() {}
ATTINY8520PU
Button 5 switches the LED