Using the parallel port for output with Linuxby Drew Perttula
Here's a tiny program for Linux that turns the parallel port's data lines on and off. parcon.c
> parcon 1h 2h 3l old = 00000000 new = 00000011to set the first and second lines high and the third low.
Here's an executable for Intel Linux systems. The program needs to be run as root. Either make yourself root before running it, or (as root)
chown root parcon chmod u+s parconThis turns on the setuid bit for the program, so it gets root privileges even when other users run it.
Here's a simple interface to parcon, written in Tcl/tk. You can click on the numbers or type them on the keyboard to toggle the states of the output lines. tkparcon
Want to use the parallel port from python? You might like to check out some SWIG modules I used on a project. Check out the whole project with:
cvs -z3 -d :pserver:email@example.com:/srcmirror co light9The file light9/light8/parport.i is a swig wrapper for parport.c which I used on a recent project. It's messy and specific to the particular hardware I was controlling, but it contains at least what you'd need. There's a makefile too. (As well as entire functioning theater lighting control system :)