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

Arduino中文社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 3699|回复: 1

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

[复制链接]
发表于 2017-11-10 15:43 | 显示全部楼层 |阅读模式
在Arduino1.85IDE中使用代码如下:
[kenrobot_code]#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("");
}[/kenrobot_code]

接收红外遥控器信号时,出现接收代码不一致问题,接收例子如下:
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,

求解

 楼主| 发表于 2017-11-10 15:47 | 显示全部楼层
默认第一个数字肯定不同,单同样的电视机遥控器,同一个按键(向下),接收数据不一致,百撕不得骑姐
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-11-28 04:38 , Processed in 0.135869 second(s), 15 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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