Feuer simulieren mit ir Ferbedienung

Das sieht so aus, als wäre das eine Samsung Fernbedienung.

Installiere doch mal folgenden Code:


// #define DECODE_SAMSUNG
#define EXCLUDE_UNIVERSAL_PROTOCOLS   // Saves up to 1000 bytes program space.
#define EXCLUDE_EXOTIC_PROTOCOLS      // saves around 650 bytes program space if all other protocols are active
#define IR_RECEIVE_PIN 9              // (Default is 2)
#include <IRremote.hpp>

void setup() {
  Serial.begin(115200);
#if defined(__AVR_ATmega32U4__) || defined(SERIAL_PORT_USBVIRTUAL) || defined(SERIAL_USB) || defined(ARDUINO_attiny3217)
  delay(1000);
#endif
  Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
  Serial.println(F("Enabling IRin..."));
  IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
  Serial.print(F("Ready to receive IR signals of protocols: "));
  printActiveIRProtocols(&Serial);
  Serial.print(F("at pin "));
  Serial.println(IR_RECEIVE_PIN);
}

void loop() {

  if (IrReceiver.decode()) {

    if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
      // We have an unknown protocol here, print more info
      IrReceiver.printIRResultRawFormatted(&Serial, true);
    } else {
      IrReceiver.printIRResultShort(&Serial);
      if (IrReceiver.decodedIRData.command == 0) { Serial.println(""); }
    }
    IrReceiver.resume();
  }
}

Da müsste dann eine Ausgabe in der Art kommen:

␁Protocol=Sony Address=0x1 Command=0x1 Raw-Data=0x81 12 bits LSB first Gap=26750us Duration=17850us
␁Protocol=Sony Address=0x1 Command=0x2 Raw-Data=0x82 12 bits LSB first Gap=516250us Duration=17850us
␂Protocol=Sony Address=0x1 Command=0x2 Raw-Data=0x82 12 bits LSB first Gap=26700us Duration=17900us
␂Protocol=Sony Address=0x1 Command=0x2 Raw-Data=0x82 12 bits LSB first Gap=26700us Duration=17850us
␂Protocol=Sony Address=0x1 Command=0x2 Raw-Data=0x82 12 bits LSB first Gap=26750us Duration=17850us
␂Protocol=Sony Address=0x1 Command=0x2 Raw-Data=0x82 12 bits LSB first Gap=26750us Duration=17850us
␂Protocol=Sony Address=0x1 Command=0x2 Raw-Data=0x82 12 bits LSB first Gap=26800us Duration=17850us
␂Protocol=Sony Address=0x1 Command=0x5 Raw-Data=0x85 12 bits LSB first Gap=647950us Duration=18450us
␅Protocol=Sony Address=0x1 Command=0x5 Raw-Data=0x85 12 bits LSB first Gap=26100us Duration=18450us
␅Protocol=Sony Address=0x1 Command=0x5 Raw-Data=0x85 12 bits LSB first Gap=26150us Duration=18450us
␅Protocol=Sony Address=0x1 Command=0x5 Raw-Data=0x85 12 bits LSB first Gap=26150us Duration=18450us
␅Protocol=Sony Address=0x1 Command=0x5 Raw-Data=0x85 12 bits LSB first Gap=26150us Duration=18450us
␅Protocol=Sony Address=0x1 Command=0x8 Raw-Data=0x88 12 bits LSB first Gap=747650us Duration=17850us
Protocol=Sony Address=0x1 Command=0x8 Raw-Data=0x88 12 bits LSB first Gap=26700us Duration=17850us
Protocol=Sony Address=0x1 Command=0x8 Raw-Data=0x88 12 bits LSB first Gap=26750us Duration=17850us
Protocol=Sony Address=0x1 Command=0x8 Raw-Data=0x88 12 bits LSB first Gap=26750us Duration=17850us

Ich habe keine Samsung Fernbedienung. Darum steht da Sony....
Entscheidend sind die "Command" Werte. Die brauchst Du später für Deine IRCommandProcessor() Funktion. Die bisher verwendeten Werte dürften hinfällig sein.