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

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3751|回复: 0

求助 关于红外遥控

[复制链接]
发表于 2015-1-24 21:06 | 显示全部楼层 |阅读模式
不太懂内部原理的渣渣自己试着改了个程序
[mw_shl_code=c,true]#include <IRremote.h>
IRsend irsend;
unsigned int open_button1[67]={
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[67]={
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);}   
    }

}[/mw_shl_code]


想实现自己的遥控器发射遥控电视的效果,然后发现似乎只能发射接收一次,求教。。。应该是循环部分的问题。。但逻辑似乎没有错误
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|Archiver|手机版|Arduino中文社区

GMT+8, 2024-11-28 02:27 , Processed in 0.114475 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表