#include <IRremoteESP8266.h>
#include <IRrecv.h>
#include <IRutils.h>
#include <RCSwitch.h>
#define IR_PIN 14 // 红外线接收模块连接的引脚号,替换成你自己的
#define RF_PIN 4 // 433MHz发射模块连接的引脚号,替换成你自己的
const unsigned long POWER_SIGNAL = 0000000000; // 需要匹配的红外信号
const unsigned int DATA[] = {-4878,+348,-363,+347,-372,+347,-721,+716,-720,+370,-348,+371,-347,+718,-373,+347,-373,+347,-720,+717,-372,+348,-720,+370,-347,+370,-347,+718,-373,+347,-374,+347,-720,+371,-347,+717,-373,+347,-722,+718,-722,+716,-374,+347,-721,+718,-721,+371,-347,+371,-347,+370,-347,+371,-348,+371,-347,+718,-721,+371,-347,+372,-347,+372,-347,+718,-372,+347,-373,+347,-721,+717,-720,+371,-348,+371,-347,+370,-347,+716,-372,+347,-720,+717,-374,+347,-721,+716,-373,+347,-721,+717,-721,+371,-347,+371,-347,+717,-3180};
IRrecv irrecv(IR_PIN);
decode_results results;
RCSwitch mySwitch = RCSwitch ();
void setup(){
Serial.begin(115200);
irrecv.enableIRIn();
mySwitch.enableTransmit(RF_PIN);
}
void loop() {
if (irrecv.decode(&results))
{
unsigned long tempResult = results.value;
Serial.print("Received IR value: ");
Serial.println(tempResult, DEC);
if (tempResult == POWER_SIGNAL) {
for (int i = 0; i < sizeof(DATA) / sizeof(DATA[0]); i++) {
mySwitch.send(DATA[i], 24);
delay(10);
}
}
irrecv.resume();
}
}
请问我的这个红外转RF怎么发射持续1分钟才停?
有那位大师给看看吗? |