求助 关于红外遥控-Arduino中文社区 - Powered by Discuz! Archiver

Quan 发表于 2015-1-24 21:06

求助 关于红外遥控

不太懂内部原理的渣渣自己试着改了个程序
#include <IRremote.h>
IRsend irsend;
unsigned int open_button1={
8850,4550,500,1700,500,650,450,650,500,600,500,650,450,600,500,650,500,600,500,1750,450,650,500,1750,450,1750,500,1750,450,1750,500,1750,450,1750,500,600,500,1750,500,600,500,1700,500,650,500,600,
500,1750,450,1750,500,1700,500,650,500,1700,500,650,450,1750,500,1750,450,650,500,600,500
};
unsigned int open_button2={
8900,4500,550,1700,500,600,500,600,550,600,500,600,500,600,500,600,550,600,500,1700,500,650,500,1700,500,1700,550,1700,500,1700,550,1700,500,1750,500,600,500,1700,500,650,500,600,500,1700,500,650,
500,1700,500,1700,550,1700,500,650,450,1750,500,1700,500,650,500,1750,450,650,450,650,500
};
int RECV_PIN=11;
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}

void loop()
{
    if(irrecv.decode(&results))
    {
    if(results.value==0x97483BFB)
    {irsend.sendRaw(open_button1,67,38);irrecv.resume();delay(5000);}
    else if(results.value==0xF0C41643)
    {irsend.sendRaw(open_button2,67,38);irrecv.resume();delay(5000);}   
    }

}


想实现自己的遥控器发射遥控电视的效果,然后发现似乎只能发射接收一次,求教。。。应该是循环部分的问题。。但逻辑似乎没有错误
页: [1]
查看完整版本: 求助 关于红外遥控