Thread: Xbox Controller
View Single Post
  #9   Spotlight this post!  
Unread 23-06-2014, 13:14
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 1,722
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Xbox Controller

Quote:
Originally Posted by LFRobotics View Post
Thanks soooo much. It all worked except for the

Code:
private Button button = new JoystickButton(xcon2, 1);
Netbeans gets all mad and says
What I would do in your case is scrap the use of the XBoxController class and use the provided Joystick class with these button/joystick mappings.

So for the A button it would be:

Code:
Joystick joystick = new Joystick(1);
private Button button = new JoystickButton(joystick, 0);
And to access the left and right sticks for tank drive it would be:

Code:
oi.joystick.getRawAxis(7); //Left stick
oi.joystick.getRawAxis(5); //Rightstick
The best way to do this would be to create a class that extends the Joystick class then:
-create getter methods for each of the buttons and axis
-create static constants that hold the mapped button numbers and axis

If you'd like more information on how to do this I can assist you there too.

Last edited by notmattlythgoe : 23-06-2014 at 13:19.
Reply With Quote