单片机控制的人行道红绿灯 #include<reg51.h> #define uchar unsigned char uchar code arr[]={ 0xbf,0x86,0xdb,0xcf,0xe6,0xed,0xfd,0x87,0xff,0xef};//共阴 uchar time1=0; uchar time2=0; uchar second1=12; uchar second2; void main() { P0=arr[second1/10]; //初始化红灯 P2=arr