<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 單片機(jī)模擬汽車轉(zhuǎn)向燈

          單片機(jī)模擬汽車轉(zhuǎn)向燈

          作者: 時間:2016-11-21 來源:網(wǎng)絡(luò) 收藏
          程序?qū)崿F(xiàn)功能,當(dāng)上燈亮低電平上燈亮,其它同樣道理,但兩燈亮低電平時,其它兩個低電平就會使亮燈不能同時亮,代碼如下:
          #include
          sbit P1_0 = P1^0;
          sbit P1_1 = P1^1;
          sbit P2_0 = P2^0;
          sbit P2_1 = P2^1;
          sbit P2_2 = P2^2;
          sbit P0_0 = P0^0;
          void delay(unsigned char i) {
          unsigned int j = 0,k = 0;
          for(k = 0; k < i; k++)
          for(j = 0; j < 255; j++);
          }
          void main(void){
          bit left,right,security;
          while(1) {
          left = P2_0;
          right = P2_1;
          security = P2_2;
          P0_0 = 0;
          if (left != 1 && right == 1) {
          P1_0 = left;
          delay(250);
          }
          if (right != 1 && left == 1) {
          P1_1 = right;
          delay(250);
          }
          if(security != 1 || (left != 1 && right != 1)) {
          //P1_0 = P1_1 = security;
          P1 = 0;
          delay(250);
          P1_0 = 1;
          P1_1 = 1;
          delay(250);
          }
          P1_0 = 1;
          P1_1 = 1;
          delay(500);
          }
          }



          評論


          技術(shù)專區(qū)

          關(guān)閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();