Joystick help

I am trying to figure out how to code for the slidder at the bottom of the joystick to equate to the speed of the robot does anyone have some example code in timed based java or some help.
thank you.

How do you want to use the throttle (axis 3)?

All the way down is 1
midway is 0
all the way up is -1

So for instance, if you just want it to limit the top speed of the robot, then you might

  • invert it (multiply by -1) to make down slow and up fast.
  • Normalize the value to between 0 and 1 (add 1 and divide by 2)
  • Use the resulting value (multipy the throttle value by the value coming from the y axis in a tank drive for instance).