跑马灯

来源:互联网 发布:java多线程编程 方腾飞 编辑:程序博客网 时间:2024/05/17 06:32
> 跑马灯应用程序#include <stdio.h>#include <stdlib.h>#include <unistd.h>#include "stdio.h"#include "sys/types.h"#include "sys/ioctl.h"#include "stdlib.h"#include "termios.h"#include "sys/stat.h"#include "fcntl.h"#include "sys/time.h"        int main()        {          int on=1;           int led;          int fd;          fd = open("/dev/leds", 0);          if (fd < 0) {                           perror("open device leds");                              exit(1);                           }           printf("leds test show. press ctrl+c to exit \n");          while(1)              {                for(led=0;led<4;led++)                  {                       ioctl(fd, on, led);                       usleep(50000);                  }               on=!on;             }        close(fd);         return 0;     }
  • usleep 计算时间为毫秒
  • juo的不quo
0 0
原创粉丝点击