#include <reg51.h>

sbit LED1 = P1^0; // 定义LED1引脚

void delay(unsigned int time) // 延时函数 { unsigned int i, j; for(i=0; i<time; i++) for(j=0; j<1275; j++); }

void main() { while(1) { LED1 = 0; // 灯亮 delay(100); // 延时100ms LED1 = 1; // 灯灭 delay(100); // 延时100ms } }

基于reg51.h的C语言LED闪烁程序

原文地址: https://www.cveoy.top/t/topic/nsjq 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录