2025-05-29 08:29:34 +08:00

40 lines
1.1 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#include "irre.h"
#include<Arduino.h>
#define IR_RECV_PIN 18
#define IR_SEND_PIN 19
// 内存预置配置示例NEC协议32位信号
BinHeader configHeader = {
.protocol = 0x0001, // NEC协议编码
.bits = 32 // 32位信号
};
// NEC协议空调开关信号单位微秒
// 协议结构:
// [引导码]9000,4500 +
// [地址码]16位 + [反码]16位 +
// [命令码]16位 + [反码]16位 +
// [结束标志]560
uint16_t rawData[68] = {
/*-- 引导码 --*/ 9000,4500,
/*-- 地址码 0x00FF --*/
560,560, 560,560, 560,560, 560,560, 560,1690, 560,560, 560,560,
/*-- 地址反码 0xFF00 --*/
560,560, 560,1690, 560,1690, 560,560, 560,1690, 560,1690, 560,1690, 560,560,
/*-- 命令码 0x12ED --*/
560,560, 560,1690, 560,560, 560,560, 560,560, 560,1690, 560,560, 560,1690,
/*-- 命令反码 + 结束符 --*/
560,1690, 560,1690, 560,1690, 560,1690, 560,1690, 560,39756
};
void setup() {
Serial.begin(115200);
while (!Serial);
Serial.println("内存配置就绪");
}
void loop() {
// 发送预存的红外信号
IrSender.sendRaw(rawData, 68, 38, IR_SEND_PIN);
delay(5000);
}