欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 單片機交通燈代碼 [打印本頁]

作者: wzd    時間: 2020-5-25 11:35
標題: 單片機交通燈代碼
#include<reg51.h>
#define uchar unsigned char
#define uint unsigned int
sbit RED_A=P0^0;
sbit YELLOW_A=P0^1;
sbit GREEN_A=P0^2;
sbit RED_B=P0^3
sbit YELLOW_B=P0^4;
sbit GREEN_B=P0^5;
uchar Flash_Count=0,Operation_Type=1;
void DelayMS(uint x)
{
uchar i;
while(x--) for(i=0;i<120;i++);
}
void Traffic_Light()
{
switch(Operation_Type)
{
case 1:
RED_A=1;YELLOW_A=1;GREEN_A=0;
RED_B=0;YELLOW_B=1;GREEN_B=1;
DelayMS(2000);
Operation_Type=2;
break;
case 2:
DelayMS(300);
YELLOW_A=~YELLOW_A;GREEN_A=1;
if(++Flash_Count!=10) return;
Flash_Count=0;
Operation_Type=3;
break;
case 3:
RED_A=0;YELLOW_A=1;GREEN_A=1;
RED_B=1;YELLOW_B=1;GREEN_B=0;
DelayMS(2000);
Operation_Type=4;
break;

Snipaste_2020-05-25_11-28-48.png (34.81 KB, 下載次數: 101)

Snipaste_2020-05-25_11-28-48.png

簡易交通燈.zip

33.06 KB, 下載次數: 4, 下載積分: 黑幣 -5






歡迎光臨 (http://www.raoushi.com/bbs/) Powered by Discuz! X3.1