芯梦启航五种流水灯模式

包括流水灯呼吸灯灯功能实现。

void Delay1(unsigned int t)
{
    while(t--);
}
unsigned char Time,i;
int j=0,l=0,m=0,n=0;
void main()
{
            P2=0x80;
            Delay(500);
            P2=0x40;
            Delay(500);
            P2=0x20;
            Delay(500);
            P2=0x10;
            Delay(500);
            P2=0x08;
            Delay(500);
            P2=0x04;
            Delay(500);
            P2=0x02;
            Delay(500);
            P2=0x01;
            Delay(500);
            P2=0x02;
            Delay(500);
            P2=0x04;
            Delay(500);
            P2=0x08;
            Delay(500);
            P2=0x10;
            Delay(500);
            P2=0x20;
            Delay(500);
            P2=0x40;
            Delay(500);
            P2=0x80;
            Delay(500);
            P2=0xff;
            Delay(2000);
            for(l=0;l<=20;l++)
            {
                P2=0x00;
                Delay(100);
                P2=0xff;
                Delay(100);
            }
            for(m=0;m<=10;m++)
            {
                P2=0x00;
                Delay(300);
                P2=0x81;
                Delay(300);
                P2=0xc3;
                Delay(300);
                P2=0xe7;
                Delay(300);
                P2=0xff;
                Delay(300);
            }
            for(n=0;n<=10;n++)
            {
            P2=0xaa;
            Delay(300);
            P2=0x55;
            Delay(300);
            }
            
            
            
            
            for(j=0;j<=10;j++)            
                {        for(Time=0;Time<100;Time++)
                {
                            for(i=0;i<20;i++)
                                {
                                    P2 = 0x00;
                                    Delay1(Time);
                                    P2 = 0xff;
                                    Delay1(100-Time);
                                }
        
        
                }
                
                for(Time=100;Time>0;Time--)
                {
                            for(i=0;i<20;i++)
                                {
                                    P2 = 0x00;
                                    Delay1(Time);
                                    P2 = 0xff;
                                    Delay1(100-Time);
                                }
        
        
                }
            }

猜你喜欢

转载自blog.csdn.net/qq_46069852/article/details/121550027