POV/Top Switch Programming for Java

So my team is trying to program the top switch for our intake wheels so that:

  • The Forward Button on the POV would shoot the ball out

  • The Backward Button on the POV would intake the ball

How do we even call the Top Switch? What method in the Joystick Class would I use???

Joystick.getPOV()

Forgive me if I make things more confusing, but;

Is the joystick you’re using the Logitech 3D one? If it is I believe it is just a hat switch, similar to the xBox controller. I hope this helps some.

The weird thing about Joystick.getPOV() is that it returns not booleans but an angle, in 45 degree increments. For example, if the user was pressing up on the DPAD, it would return zero. If the bottom and left buttons are being pressed, it would return 135. If no buttons are pressed, it would return -1.

I actually just wrote a class today to handle this, though it might not be useful outside of our larger system.