您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > 单片机按钮控制正反流水灯
#includereg51.hvoiddelay(unsignedinti);sbitbtn1=P3^2;sbitbtn2=P3^3;#defineLP1voidmain(){btn1=1;btn2=1;while(1){if(btn1==0){L=0xFE;delay(50000);L=0xFD;delay(25000);L=0xFB;delay(25000);L=0xF7;delay(25000);L=0xEF;delay(25000);L=0xDF;delay(25000);L=0xBF;delay(25000);L=0x7F;delay(25000);}else{L=0xFF;}if(btn2==0){L=0x7F;delay(25000);L=0xBF;delay(25000);L=0xDF;delay(25000);L=0xEF;delay(25000);L=0xF7;delay(25000);L=0xFB;delay(25000);L=0xFD;delay(25000);L=0xFE;delay(25000);}else{L=0xFF;}}while(1){;}}voiddelay(unsignedinti){while(--i);}
本文标题:单片机按钮控制正反流水灯
链接地址:https://www.777doc.com/doc-2594406 .html