51单片机-点亮LED灯

//LED灯亮灭,间隔时间1秒

#include <reg51.h>

sbit led = P1^0;

void Delay(unsigned int z)

{

    unsigned int x, y;

    for(x = z; x > 0; x--)

        for(y = 110; y > 0; y--);

}

void main()

{

    led = 0;

    while(1)

    {

        led = ~led;

        Delay(1000);

    }

}

没有更多推荐了,返回首页