#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main(int argc, char **argv)
{
int fd,i;

  fd=open("/dev/led",O_WRONLY);
  if (fd==-1) {
    fprintf(stderr,"Could not open LED device /dev/led\n");
    exit(-1);
  }
  i=1;
  while(1) {
    for (i=64; i>0; i/=2) {
      write(fd,&i,1);
      usleep(100000);
    }
    for (i=2; i<256; i*=2) {
      write(fd,&i,1);
      usleep(100000);
    }
  }
  close(fd);

return 0;
}
