码迷,mamicode.com
首页 > 其他好文 > 详细

443M衣架遥控arduino代码备档

时间:2018-05-21 01:07:39      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:mic   led   r++   start   span   []   code   output   ++   

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); //下降

 

443M衣架遥控arduino代码备档

标签:mic   led   r++   start   span   []   code   output   ++   

原文地址:https://www.cnblogs.com/hanf/p/9065290.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!