Xbox Controller POV Button

Hey everyone, I’m very familiar with the new Command Based framework for Joystick Buttons but im struggling to figure out how to map a POV button to a whenPressed command.

We just want the button to change a variable in a subsystem using a lambda function (which is easy to implement, we just need to get the button mapping done).

Essentially in the RobotContainer, we want:
new JoystickButton(operatorController, (POV UP Button)).whenPressed(() -> vision.changeTarget());

Any help would be appreciated.

I think this was covered in this post.


The answer is exactly what @chadr03 linked to. Just use a POVButton object. It extends “Button”, so you have all of the whenPressed/whileHeld/etc methods available

1 Like

Thank you. I remembered seeing this post but couldn’t remember what it was called.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.