nierixin 发表于 2013-7-15 20:40:00

arduino 红外线发射接受问题

#include <IRremote.h>

int RECV_PIN=6;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
unsigned long date;

unsigned int rawCodes_Open_Close={-25450, 2400, -550, 1250, -500, 650, -550, 1250, -500, 650, -550, 1250, -550, 600, -550, 650, -550, 1250, -500, 650, -550, 650, -550, 600, -550, 650};


void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop(){
if (irrecv.decode(&results)){
    Serial.println("Open_Close1");
    for(int i = 0 ;i < 3 ; i ++){
   irsend.sendSony(0xa90, 12); //
   //irsend.sendRaw(rawCodes_Open_Close,26, 38);
    delay(100);
    }
Serial.println("Open_Close2");
    irrecv.resume();
}
}

对着接收器按遥控器,按N次也只输出一次Open_Close1 和 一次 Open_Close2? 这是为什么呢?

瘦网虫 发表于 2013-7-15 23:39:53

负号去掉。

学长 发表于 2013-7-16 01:11:31

负号去掉 第一笔数据去掉

nierixin 发表于 2013-7-16 09:52:56

学长 发表于 2013-7-16 01:11 static/image/common/back.gif
负号去掉 第一笔数据去掉

第一笔数据去掉?是第一次输入不接受直接跳过么?

nierixin 发表于 2013-7-16 09:56:35

瘦网虫 发表于 2013-7-15 23:39 static/image/common/back.gif
负号去掉。

#include <IRremote.h>
int RECV_PIN=6;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
unsigned long date;

unsigned int rawCodes_Open_Close={25450, 2400, 550, 1250, 500, 650, 550, 1250, 500, 650, 550, 1250, 550, 600, 550, 650, 550, 1250, 500, 650, 550, 650, 550, 600, 550, 650};
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn();
}
void loop(){
if (irrecv.decode(&results)){
    Serial.println("Open_Close1");
    for(int i = 0 ;i < 3 ; i ++){
   irsend.sendRaw(rawCodes_Open_Close,26, 38);; //
    delay(100);
    }
Serial.println("Open_Close2");
    irrecv.resume();
}
}

还是只能输出一次!

nierixin 发表于 2013-7-16 10:40:38

学长 发表于 2013-7-16 01:11 static/image/common/back.gif
负号去掉 第一笔数据去掉

试了好多次了,只要有发射数据后,就再也接收不到红外线信息了,这是怎么回事啊?

nierixin 发表于 2013-7-16 15:19:27

学长 发表于 2013-7-16 01:11 static/image/common/back.gif
负号去掉 第一笔数据去掉

弄好了,加了个初始化

nierixin 发表于 2013-7-16 15:19:44

瘦网虫 发表于 2013-7-15 23:39 static/image/common/back.gif
负号去掉。

弄好了,加了个初始化~

ywg0354 发表于 2014-3-8 16:20:01

nierixin 发表于 2013-7-16 15:19 static/image/common/back.gif
弄好了,加了个初始化~

在哪个位置加的的呢,我也遇到了这样的问题。

宇宙天心 发表于 2014-3-8 16:59:40

我的编泽错误是什么问题
页: [1]
查看完整版本: arduino 红外线发射接受问题