c语言设置led指示灯状态(open)
作者:互联网
void set_led_blink(char *path , int state) { int fd; char buf; switch(state) { case 0: buf = '0'; break; case 1: buf = '1'; break; case 2: buf = '2'; break; default: break; } fd = open(path,O_RDWR); write(fd,&buf,sizeof(buf)); close(fd); }
标签:case,指示灯,char,led,int,open,break,fd,buf 来源: https://www.cnblogs.com/hshy/p/16380574.html