上传文件至 红外
This commit is contained in:
parent
86731ce01b
commit
8f306d1955
40
红外/ir_controller.ino
Normal file
40
红外/ir_controller.ino
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user