Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#194543 - 22/12/2003 18:44 Joystick unplugged/plugged, +5v, what?
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31571
Loc: Seattle, WA
I'm working on the thermistor-on-the-joystick-port trick that I discussed in another thread. What I'm trying to do is just put a thermistor on the X axis of the joystick port and read that.

When I put a real joystick on the port, my software reads the X axis correctly. But when I unplug the joystick and put the thermistor on the pins that would normally be the X axis potentiometer, the Windows API returns a "joystick is unplugged" error code when I call the function.

How does Windows decide whether a joystick is plugged in or not? Are there other pins I need to bridge or something?

(Note that this is an old-style 15-pin analog joystick port.)

Or maybe I'm putting the thermistor on the wrong pins, too. I'm using the X axis sense pin (pin 3) and the ground next to it (pin 4). Am I supposed to connect it to +5vdc and the X axis pin instead of ground and X axis?

I used to know this stuff by heart, once upon a time, when I'd build joysticks from scratch to make things like homemade steering wheel controllers. It's been so long since I've done it though.
_________________________
Tony Fabris

Top
#194544 - 22/12/2003 18:55 Re: Joystick unplugged/plugged, +5v, what? [Re: tfabris]
tfabris
carpal tunnel

Registered: 20/12/1999
Posts: 31571
Loc: Seattle, WA
Never mind, figured it out myself. (a) joystick sense is pins 1-3 for x, and pins 6-8 for y. That's +5v and the X sensor, and +5v and the Y sensor. (b) Need a value on both the X and the Y axes to keep Windows happy. Not enough to just have a value on X.
_________________________
Tony Fabris

Top