> 跑马灯应用程序
#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;
}