#include <IRremote.hpp>
#define IR_SEND_PIN 26
void setup() {
Serial.begin(115200);
IrSender.begin(IR_SEND_PIN); // Start with IR_SEND_PIN as send pin and enable feedback LED at default feedback LED pin
Serial.printf("Send IR signals at pin %d",IR_SEND_PIN);
}
uint16_t sAddress = 0x0102;
uint8_t sCommand = 0x34;
uint8_t sRepeats = 1;
/*
* Send NEC IR protocol
*/
void send_ir_data() {
Serial.print(F("Sending: 0x"));
Serial.print(sAddress, HEX);
Serial.print(sCommand, HEX);
Serial.println(sRepeats, HEX);
Serial.flush(); // To avoid disturbing the software PWM generation by serial output interrupts
// clip repeats at 4
if (sRepeats > 4) {
sRepeats = 4;
}
// Results for the first loop to: Protocol=NEC Address=0x102 Command=0x34 Raw-Data=0xCB340102 (32 bits)
IrSender.sendNEC(sAddress, sCommand, sRepeats);
}
void loop() {
/*
* Print loop values
*/
Serial.println();
Serial.print(F("address=0x"));
Serial.print(sAddress, HEX);
Serial.print(F(" command=0x"));
Serial.print(sCommand, HEX);
Serial.print(F(" repeats="));
Serial.println(sRepeats);
Serial.flush();
send_ir_data();
// Prepare data for next loop
sAddress += 0x0101;
sCommand += 0x11;
sRepeats++;
delay(200); // Loop delay
}