Created
February 1, 2015 00:53
-
-
Save TechplexEngineer/09cf066376dd9f22a185 to your computer and use it in GitHub Desktop.
xbox controller frc code untested
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class XboxController { | |
| private Joystick joystick_; | |
| XboxController(int port) { | |
| joystick_ = new Joystick(port); | |
| } | |
| public boolean isA() { | |
| joystick_.getRawButton(0); | |
| } | |
| public boolean isB() { | |
| joystick_.getRawButton(1); | |
| } | |
| public boolean isX() { | |
| joystick_.getRawButton(2); | |
| } | |
| public boolean isY() { | |
| joystick_.getRawButton(3); | |
| } | |
| public boolean isLB() { | |
| joystick_.getRawButton(4); | |
| } | |
| public boolean isRB() { | |
| joystick_.getRawButton(5); | |
| } | |
| public boolean isBack() { | |
| joystick_.getRawButton(6); | |
| } | |
| public boolean isStart() { | |
| joystick_.getRawButton(7); | |
| } | |
| public boolean isLeftStick() { | |
| joystick_.getRawButton(8); | |
| } | |
| public boolean isRightStick() { | |
| joystick_.getRawButton(9); | |
| } | |
| public double getLeftStickX() { | |
| joystick_.getRawAxis(0); | |
| } | |
| public double getLeftStickY() { | |
| joystick_.getRawAxis(1); | |
| } | |
| public double getLeftTrigger() { | |
| joystick_.getRawAxis(2); | |
| } | |
| public double getRightTrigger() { | |
| joystick_.getRawAxis(3); | |
| } | |
| public double getRightStickX() { | |
| joystick_.getRawAxis(4); | |
| } | |
| public double getRightStickY() { | |
| joystick_.getRawAxis(5); | |
| } | |
| public double getRawButton(int button) { | |
| joystick_.getRawButton(button); | |
| } | |
| public double getAxisButton(int button) { | |
| joystick_.getAxisButton(button); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment