Problems hooking up a joystick to edubot

Okay…so i want to drive the edubot via a joystick, so i solder a connecter that puts it out to PWM cables. Now the connecter etc… works but i can’t get the joystick to output anything except 255
basically the code is :

Now when i run printf says 255 all the time for speed1!
The joystick works, all the connectors are fine, but when i measure volts it always says ~5V even if you connect SIG and Ground or SIG and +5V or +5V and Ground
regardless of joystick movement!!!>???
I went in to the code and set analog inputs to 3 etc…but before i had a gyro hooked in analog in 1 and it worked so i don’t get why this doesn’t work!
Any help appreciated

Have you tried using different joysticks or potentiometers? It sounds like you either have something connected wrong or you are using a defective joystick.

Well, the problem is you can connect the joystick directly to the analog input of the EDU bot (or the RC for that matter), with out modifiying the joystick or adding an external resistor. (or other circuitry)

To hook a pot up to the analog input, you connect one side to +5, the other to Gnd, and the center to the input. this the creates a voltage divider such that the voltage on the signal pin varies as you turn the knob.

However, with a joystick, only one of the ends, (the Gnd side) and the wiper are wired to the connector. To hook it directly to the analog input you would either need to connect the other side of the pot in the joystick to +5, or connect a resistor from signal to +5. 50k is about what you want I think (1/2 total value of the joystick. )

The problem with the external resistor is that value read by the joystick is no longer linear with the movement of the joystick.