|
Re: Run Command Once When Trigger is Pressed
Here is an example of running commands whenever a joystick button is pressed. You can also associate commands with buttons from the Cypress module or any arbitrary polled trigger (see Trigger class).
http://Wpilib.screenstepslive.com/s/3120/m/7952/l/97457
Besides using whenPressed() you can also call whenReleased() to get a command to run when the button is released or whileHeld() to get a command to repeatedly run while the button is pressed.
Brad
__________________
Brad Miller
Robotics Resource Center
Worcester Polytechnic Institute
|