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;
}
}
亮度调节和时间控制在switch里但是只能进一个程序,,,哪个在前进哪个
cs=1;
这里限定了cs只能到4,可以改成 if (cs==12)试试看
4只是用于前边测试用,只要一组成了,其他的肯定就好了嘛,就case=1之后,要么进调亮程序,要么进计时程序。。不能一起么这个?
http://bbs.elecfans.com/jishu_1519472_1_1.html
一周热门 更多>