欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

 找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 3596|回復(fù): 1
收起左側(cè)

arduino 433M無線遙控接收問題求助

[復(fù)制鏈接]
ID:389836 發(fā)表于 2019-1-7 12:55 | 顯示全部樓層 |閱讀模式
433遙控器,我用庫RCSwitch里面接收例程,收到信號(hào)的value值是:

遙控器按鍵A:Received 5264652 / 24bit Protocol: 1
遙控器按鍵B:Received 5264688 / 24bit Protocol: 1
以上是串口讀取出的數(shù)據(jù)。

#include <RCSwitch.h>
int led=13;

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  pinMode(led,OUTPUT);
  mySwitch.enableReceive(0);  // Receiver on inerrupt 0 => that is pin #2
}

void loop() {
  if (mySwitch.available()) {

    int value = mySwitch.getReceivedValue();

    if (value == 0) {
      Serial.print("Unknown encoding");
    } else {
      Serial.print("Received ");
      Serial.print( mySwitch.getReceivedValue() );
      Serial.print(" / ");
      Serial.print( mySwitch.getReceivedBitlength() );
      Serial.print("bit ");
      Serial.print("Protocol: ");
      Serial.println( mySwitch.getReceivedProtocol() );
    }
    if(value==5264652){
      digitalWrite(led,HIGH);
          }
    if(value==5264688){
      digitalWrite(led,LOW);
         }

    mySwitch.resetAvailable();
  }
}


以上是例程代碼簡單修改,就是按鍵A時(shí),LED亮燈,按鍵B時(shí),LED滅燈;
實(shí)際情況是LED不亮燈也不滅燈,哪位大俠幫我看看問題出在哪里?


我還是放上接收解碼的例程吧:
/*
  Simple example for receiving
*/

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  mySwitch.enableReceive(0);  // Receiver on inerrupt 0 => that is pin #2
}

void loop() {
  if (mySwitch.available()) {

    int value = mySwitch.getReceivedValue();

    if (value == 0) {
      Serial.print("Unknown encoding");
    } else {
      Serial.print("Received ");
      Serial.print( mySwitch.getReceivedValue() );
      Serial.print(" / ");
      Serial.print( mySwitch.getReceivedBitlength() );
      Serial.print("bit ");
      Serial.print("Protocol: ");
      Serial.println( mySwitch.getReceivedProtocol() );
    }

    mySwitch.resetAvailable();
  }
}


回復(fù)

使用道具 舉報(bào)

ID:585217 發(fā)表于 2019-7-16 16:19 | 顯示全部樓層
你好 怎么發(fā)送的放float數(shù)據(jù) 接收到的只能是int整數(shù)
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表