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);
}
浙公网安备 33010602011771号