443M衣架遥控arduino代码备档

byte up[65] = {0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,1,1,1,1,1};
byte lm[65] = {0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1};
byte dn[65] = {0,0,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0,0,1,1,0,1,1,1,1};

void RFControl(byte output[]){
    digitalWrite(p_led, HIGH);
    for(int r = 0; r < 4; r++){
      //start
      digitalWrite(p_opt, HIGH);delayMicroseconds(5120);
      digitalWrite(p_opt, LOW); delayMicroseconds(580);
  
      for(int i = 0; i< 65; i++){
        if(output[i] == 0){        //0
          digitalWrite(p_opt, HIGH);delayMicroseconds(190);
          digitalWrite(p_opt, LOW); delayMicroseconds(580);
        }
        else{        //1
          digitalWrite(p_opt, HIGH);delayMicroseconds(580);
          digitalWrite(p_opt, LOW); delayMicroseconds(190);
        }
      }
    }
    digitalWrite(p_led, LOW);
}

//调用
RFControl(up); //上升
RFControl(lm); //开关灯
RFControl(dn); //下降

 

posted @ 2018-05-21 00:04  Hanf  阅读(293)  评论(0编辑  收藏  举报
Copyright © 2008-2016 Hanf All Rights Reserved