View Single Post
  #2   Spotlight this post!  
Unread 16-02-2012, 01:11
Zero_Viscosity Zero_Viscosity is offline
Registered User
FRC #3344
 
Join Date: Feb 2012
Location: Fayetteville Georgia
Posts: 5
Zero_Viscosity is an unknown quantity at this point
Re: Joystick Buttons (or general C++ guidance)

Well, I believe that the JoyStick class has a "JoyStickButton"(or something similar) function.

There is a WPIlib documentation file which is very useful, it came with your WPIlib download.
Here is something that should make the robot drive forward for 1 second when "1" is pressed on the controller.
Code:
if(JoyStick1.RawButtonValue(1)
Drive(.5,1);
else
Drive(0.0,0.0);
Try putting that in the OperatorControl function
By the way, you would need to edit "JoyStick1" to the name of your mainstick.
If you are using SimpleTemplate and have not changed anything, it should be "stick"
Reply With Quote