zoukankan      html  css  js  c++  java
  • Arduino 433 自定义接受

    /*
      Simple example for receiving
      
      https://github.com/sui77/rc-switch/
    */
    
    #include <RCSwitch.h>
    #define led1 10  
    #define led2 11  
    RCSwitch mySwitch = RCSwitch();
    
    void setup() {
      Serial.begin(9600);
        pinMode(led1, OUTPUT);    
          pinMode(led2, OUTPUT);    
      mySwitch.enableReceive(0);  // Receiver on interrupt 0 => that is pin #2
    }
    
    void loop() {
      if (mySwitch.available()) {
        
        int value = mySwitch.getReceivedValue();
        
        if (value == 0) {
          Serial.print("Unknown encoding");
        } else {
          if (value ==17) { 
            if( digitalRead(led1)==0){
            digitalWrite(led1, HIGH);
            }
            else{
               digitalWrite(led1, LOW);
              }
            }
          if (value ==18) { 
    
             if( digitalRead(led2)==0){
            digitalWrite(led2, HIGH);
            }
            else{
               digitalWrite(led2, LOW);
              }
          
          
          }
          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();
      }
    }
    

      

  • 相关阅读:
    nuget
    C#枚举中使用Flags特性
    情感分析
    docker
    core部署
    脱壳系列_2_IAT加密壳_详细分析(含脚本)
    安全公司-* * * *-面试题:_ 安卓逆向分析分享
    18_ShadowWalker
    17_页面异常接管
    16_TLB与流水线
  • 原文地址:https://www.cnblogs.com/kekeoutlook/p/8207103.html
Copyright © 2011-2022 走看看