I'm on the road so I cannot offer up examples, but I can comment on what you have.
The code you posted has a chicken/egg issue.
None of the Latches are guaranteed to have been set by the loops on the left, before being used in the case statement to the right.
The case statement code on the right happens simultaneously with the checks you are performing on the left.
As far as using joystick buttons to select a motor speed, you can do something like this. Add more buttons (one speed and one Select per new button) for more variations in speed.
It just remembers (latches) the speed associated with the last button pushed.
I can't tell if this is in line with how you are trying to employ the buttons.
