Log in

View Full Version : POV/Top Switch Programming for Java


koreamaniac101
11-02-2016, 18:27
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???

cgmv123
11-02-2016, 18:29
Joystick.getPOV()

xXhunter47Xx
11-02-2016, 18:34
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.

MultipleMono
12-02-2016, 21:40
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 (https://github.com/Team3128/frc-java-3128/blob/master/src/org/team3128/listener/control/POV.java) today to handle this, though it might not be useful outside of our larger system.