#include <stdio.h>
void main(){
int fd;
struct timespec tiempo;
tiempo.tv_sec = 0;
fd = open("/dev/lpv",O_RDWR); [ See NOTE ]
while(1){
write(fd,"1",1);
}
close(fd);
}
[ NOTE ]
//
// sqr.c
//
#include <fcntl.h>
#include <time.h>
#include "lpv.h"
short number = 0x1111;
unsigned char buffer;
tiempo.tv_nsec = 1 * 1000000;
if (fd<0) {
perror("Could not open");
exit(-1);
}
nanosleep(&tiempo,NULL);
write(fd,"2",1);
nanosleep(&tiempo,NULL);
/dev/lpv is a very simple parallel port driver.
See code.