Log in

View Full Version : Using Command base system


Biolore
02-02-2012, 18:26
so... I'm trying to use the new command base system, so I've gone through the cookbook thing. I don't understand how to make a button on a controller link to a command. The cookbook uses a button class that isn't in the library, so how does this work?

RufflesRidge
02-02-2012, 18:33
It sounds like you're looking for the classes in wpilibj.buttons

eddie12390
03-02-2012, 11:15
It sounds like you're looking for the classes in wpilibj.buttons

Button js1_button1 = new JoystickButton(js1, 1); // Create a Joystick Button, arguments sent to the constructor are (stickObject, button number)

js1_button1.whileHeld(new CommandHere()); or js1_button1.whenPressed(new CommandHere()); // buttonObject.whileHeld, whenPressed, or whenReleased (new Command Name());