关于接收红外数据不一致问题-Arduino中文社区 - Powered by Discuz! Archiver

chinawhw 发表于 2017-11-10 15:43

关于接收红外数据不一致问题

在Arduino1.85IDE中使用代码如下:
#include <IRremote.h>

int RECV_PIN = 10;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
Serial.begin(9600);
Serial.println("start receive IR:");
irrecv.enableIRIn(); // Start the receiver
}

void loop() {
if (irrecv.decode(&results)) {
    dump(&results);
    irrecv.resume(); // Receive the next value
}
}

void dump(decode_results *results) {
int count = results->rawlen;
Serial.print("Raw (");
Serial.print(count, DEC);
Serial.print("): ");

for (int i = 0; i < count; i++) {
      Serial.print(results->rawbuf*USECPERTICK, DEC);
    Serial.print(",");
}
Serial.println("");
}

接收红外遥控器信号时,出现接收代码不一致问题,接收例子如下:
Raw (68): 37160,8450,4250,500,550,500,1700,450,600,500,1650,500,600,450,1700,500,550,500,1700,500,1700,500,550,500,1700,450,600,500,1650,500,600,450,1700,500,550,500,600,500,1650,500,550,500,1700,500,1700,500,550,500,1700,500,550,500,1700,450,600,500,1650,500,600,450,600,500,1650,500,600,500,1650,500,
Raw (68): 10698,8450,4250,500,550,500,1700,500,550,500,1700,450,600,500,1650,500,600,450,1700,500,1700,500,550,500,1700,500,550,500,1700,450,600,500,1650,500,600,450,600,500,1650,500,600,500,1650,500,1700,500,550,500,1700,500,550,500,1700,450,600,500,1650,500,600,500,550,500,1650,500,600,500,1650,500,

求解

chinawhw 发表于 2017-11-10 15:47

默认第一个数字肯定不同,单同样的电视机遥控器,同一个按键(向下),接收数据不一致,百撕不得骑姐:(
页: [1]
查看完整版本: 关于接收红外数据不一致问题