#include<reg52.h> void Delay(unsigned int t); void main() { unsigned char i,j; while(1) { Delay(5000); P1=0xee; for(j=0;j<15;j++) { for(i=0;i<4;i++) { Delay(2000); P1<<=1; P1=P1|0x01; } P1=0x77;//01110111 for(i=0;i<4;i++)//1、5灯左右移动 { Delay(4000); P1>>=1;//00111011,1、5灯右移 P1=P1|0x80; } P1=0xee;//11101110 } for(j=0;j<5;j++)//4灯右移 { Delay(2000); P1>>=1;//01110111 P1=P1|0x80; } P1=0x01;//00000001 for(i=0;i<8;i++) { Delay(5000); P1<<=1; P1=P1|0x01; } for(i=0;i<4;i++) { P1=0x00; Delay(10000); P1=0xff; Delay(10000); } P1=0xee; } } void Delay(unsigned int t) { while(--t); }
看不懂啊,怎么理解,可以说一下吗,大哥
欢迎光临 (http://www.51hei.com/bbs/) | Powered by Discuz! X3.1 |