// rs232_to_led.c // e.boelen 5 Mar 2002 // a small c program that will turn pin 4 on a rs232 port 'high' #include #include #include #include #include int main(int) { int fd,dtr,i; char device[255] = "/dev/ttyS0"; // this is serial port 0 ttyS1 is port1 fd = open(device, O_RDWR); if (fd == -1) { char s[255]; sprintf(s, "statserial: can't open device `%s'", device); perror(s); exit(1); } dtr=TIOCM_RTS; // Set RTS (pin 4) ioctl(fd, TIOCMBIS,&dtr); // low level io function sleep(60); // pause for 60 seconds }