views:

626

answers:

4

My father would like to use Ubuntu for LPT programming (via a relay card). He is used to QBasic and PowerBasic but willing to learn a new (simple) language for his goals.

What recommendations can you give me for this task?

Python would be my favourite if the module pyParallel worked. If there are other modules available for Python, let me know.

I cannot change the hardware, it's a requirement to only change software.

Thanks in advance for any hints!

+1  A: 

http://www.mono-project.com/Visual%5FBasic He'll at least be familiar with the language, but accessing the parallel port is a more complicated task. I know there is a way, but all the samples online deal with windows libraries.

hova
Why is that so complicated? :( In QBasic it's a one-liner...
furtelwart
Of course QBasic (on dos) doesn't have a memory protected operating system running above it either.
Matthew Whited
+1  A: 

The Python is not easier than Basic. But I think for parallel port and other hardware programming C is a natural choice. It's not that hard to learn and it's worth to spend some time learning C.

grigy
It's fairly easy to learn C, but it's harder to learn how to program well in it. I'd suggest that people learn C either because they need it, or as part of getting deeper knowledge of computers and computation.
David Thornley
C would be a nice solution, but I think it's too hard to achieve little tasks.
furtelwart
+1  A: 

An alternative might be Arduino, it has it's own IDE and can interface with tons of languages as well as run on all platforms. It's more of a hobbyists thing but might work out for you.

Phill Pafford
The hardware must be LPT. Only software may change.
furtelwart
+2  A: 

The Python module pyParallel works. I had tried the release last time. Yesterday I used the HEAD revision and it works.

For somebody trying to do the same procedure:

  1. Download & install the HEAD revision of pyParallel.
  2. Unload the kernel module lp and load ppdev. It lets you access the parallel port device file.
  3. a) Add your OS user to the group lp so it has write access to /dev/parport*.
    b) Otherwise execute this: # chmod a+rw /dev/parport*
  4. Hack your program!

Steps 2., 3. b) and 4. must repeated every reboot. The blacklisting does not work properly (yet).
You can create a udev rule for the parport device file so that every user has write access to it.

Update: The blacklist now works. It was a bug in Ubuntu 9.04 with CUPS. In 9.10 it works perfectly.

Happy hacking!

furtelwart