void keyscan()
{
if (k1==0)
Delayms(20);
if (k1==0)
{ while (!k1);
cs++;
if (cs==4)
cs=1;
}
switch (cs)
{
case 1:
//hight();//高亮状态,进入定时并显示状态
led_3 ();
break;
case 2:
//bight();//中亮
led_3 ();
break;
case 3:
//light();//低亮
led_3 ();
break;
case 4:hight();break; //¾²Ö¹×´Ì¬
case 5:bight();break;
case 6:light();break;
case 7: //
led_2();
break;
case 8:
led_2();
break;
case 9:
led_2();
break;
case 10: //¶¨Ê±30Ãë
led_1();
break;
case 11:
led_1();
break;
case 12:
led_1();
break;
void keyscan()
{
if (k1==0)
Delayms(20);
if (k1==0)
{ while (!k1);
cs++;
if (cs==4)
cs=1;
}
switch (cs)
{
case 1:
//hight();//高亮状态,进入定时并显示状态
led_3 ();
break;
case 2:
//bight();//中亮
led_3 ();
break;
case 3:
//light();//低亮
led_3 ();
break;
case 4:hight();break; //¾²Ö¹×´Ì¬
case 5:bight();break;
case 6:light();break;
case 7: //
led_2();
break;
case 8:
led_2();
break;
case 9:
led_2();
break;
case 10: //¶¨Ê±30Ãë
led_1();
break;
case 11:
led_1();
break;
case 12:
led_1();
break;
}
}
这是最终while(1)循环的按键检测程序,,亮度程序和定时显示程序只能进一个,。。。额..
一周热门 更多>