View Single Post
  #10   Spotlight this post!  
Unread 10-08-2013, 17:52
alexhenning alexhenning is offline
WPILib Developer
FRC #0348
 
Join Date: Apr 2010
Rookie Year: 2003
Location: MA
Posts: 49
alexhenning will become famous soon enough
Re: commands activated by trigger, how?

There is online documentation for CommandBased programming, in particular this link shows how to attach commands to a joystick.

Code:
Joystick DriveStick = new Joystick(1);
Button button = new JoystickButton(joystick, BUTTON_NUMBER);
public OI() {
    button.whenPressed(new LauncherSpinWheels());
    // ...
}
Replace BUTTON_NUMBER with the button you want to run the command.

In addition to the online documentation, you might find these videos helpful if you're having trouble understanding CommandBasedProgram.:
CommandBased Programming with RobotBuilder: http://www.youtube.com/watch?v=k7PaY...lgn vhGObeKzp
CommandBased Programming without RobotBuilder: http://www.youtube.com/watch?v=v0vt9yKLxUQ
Reply With Quote