[C] 纯文本查看 复制代码
#include <Arduino.h>
#include <IRremoteESP8266.h>
#include <IRsend.h>
const uint16_t kIrLed = 18; //
IRsend irsend(kIrLed);
uint16_t rawData[229] = {
3056, 3004, 2972, 4546, 520, 1698, 520, 580, 520, 1698, 520, 590, 518, 582, 518, 1700,
520, 1700, 520, 588, 520, 1700, 520, 580, 520, 1700, 520, 588, 520, 580, 520, 580,
520, 1698, 520, 588, 520, 580, 518, 582, 518, 580, 518, 590, 520, 580, 518, 580,
518, 580, 520, 588, 520, 580, 518, 582, 518, 580, 518, 590, 518, 582, 518, 580,
520, 580, 518, 590, 518, 580, 518, 1700, 518, 580, 518, 590, 518, 580, 518, 582,
518, 582, 518, 590, 518, 580, 518, 582, 518, 1700, 518, 590, 518, 582, 518, 582,
518, 580, 518, 592, 518, 582, 518, 582, 518, 582, 518, 590, 518, 582, 518, 582,
518, 582, 518, 590, 518, 582, 518, 582, 518, 1702, 518, 590, 518, 582, 518, 582,
518, 582, 518, 590, 518, 582, 518, 582, 518, 582, 518, 590, 518, 582, 518, 582,
518, 582, 516, 590, 518, 582, 518, 582, 518, 582, 518, 590, 518, 582, 518, 582,
518, 582, 518, 590, 518, 582, 518, 582, 518, 582, 518, 590, 518, 582, 516, 584,
516, 582, 518, 590, 518, 582, 518, 582, 518, 582, 518, 592, 516, 582, 518, 582,
518, 582, 516, 592, 516, 582, 518, 584, 516, 582, 518, 590, 518, 582, 518, 1700,
518, 582, 516, 1710, 518, 1700, 518, 1702, 518, 582, 516, 592, 518, 1702, 516, 1702,
518, 582, 516, 1712, 516
};
void setup() {
Serial.begin(115200);
delay(1000);
irsend.begin();
Serial.println("Sending Power ON (strong version)...");
for (int i = 0; i < 5; i++) { // 连续发送 5 次
irsend.sendRaw(rawData, 229, 38);
delay(80);
}
Serial.println("Finished sending 5 times");
}
void loop() {
// 每 8 秒再发一次,方便你测试
delay(8000);
Serial.println("Sending again...");
for (int i = 0; i < 3; i++) {
irsend.sendRaw(rawData, 229, 38);
delay(80);
}
}