#include<reg52.h>
sbit key1=P3^2;
sbit key2=P3^3;
sbit key3=P3^4;
sbit key4=P3^5;
sbit out1=P0^0;
sbit out2=P0^1;
void delay(unsigned int cnt)
{
while(--cnt);
}
main()
{
P0=0xff;
while(1)
{
{if(!key1)
out1=0;
out2=0;}問題:我想在此加入1S延時,使之在亮1S后為1,就是關閉?
{if(!key2)
out1=1;}
}
}
加個delay 程序 然后在這里調(diào)用下
歡迎光臨 (http://www.torrancerestoration.com/bbs/) | Powered by Discuz! X3.1 |