void main()
{
while(1)
{
if(KEY==0)
{
delay(5);
if(KEY==0)
{
n=1;
LED=~LED;
delay(1);
}
if(KEY==0)
{
n=2;
delay(5000);
}
if(KEY==0)
{
delay(1000);
delay(1000);
delay(1000);
delay(1000);
if(KEY==0)
n=3;
}
while(KEY==0);
}
if(n==3) while(1)
{
LED=~LED;
delay(150);
}
if(n==2) while(1)
{
LED=~LED;
delay(1000);
}
}
} 用它实现按一下键 led电平翻转 双击按键后出现10hz的闪烁 长按后 出现1hz的闪烁 |