单片机按钮控制正反流水灯

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#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);}

1 / 1
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功