tags:

views:

243

answers:

3

I like programming with robots and stuff. For this approach, I'm using the LPT port for output and the Gameport for input.

For younger guys: Just some old fashioned USB Ports ;-)
Game Port Parallel Port

With Python (and the fabulous module pyParallel) the output works very, very well.

Now I'd really like to get data from the Game Port (like photo tubes, temperatur sensors etc.). How can I accomplish this?
Ah, by the way: I'm using Ubuntu for all that stuff.

+1  A: 

I cannot really help you much. I don't work with joy/parallel port anymore and I forgot almost everything. What I can tell you is that under linux, there's a specific driver and device for the joystick port. You find information about it here (google cache, the main doc is down)

http://74.125.153.132/search?q=cache%3AoKDIwlR1TvYJ%3Awww.infiscape.com/~patrick/vrjuggler-config/2.0/configuring%5Fvr%5Fjuggler/apcs05.html+joystick+device&cd=1&hl=en&ct=clnk&client=firefox-a

I am pretty confident the kernel module still exists. Once you modprobe it, you will get access to the /dev/js0 device. You will have to read from that, raw, unless you find a better library solution.

By the way, remember that you can read digital from the parallel port, if I am not mistaken. It's just unusual and hacky, and for your sensors the game port makes more sense (since you have analog input) but if you want to go digital, remember you have the choice to go parallel 100 %.

Stefano Borini
Thanks for the nice hint in the last paragraph, it's great.I found the kernel module, too, but haven't found any high level lib for that...
furtelwart
+1  A: 

Have you looked at pygame's joystick package: http://www.pygame.org/docs/ref/joystick.html ?

Suppressingfire
+1  A: 

If your just looking for controller input (USB Joystick, Gamepad, etc) PyGame has an input module that works nicely.

crgwbr