|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.wpi.first.wpilibj.buttons.Trigger
edu.wpi.first.wpilibj.buttons.Button
public abstract class Button
This class provides an easy way to link commands to OI inputs. It is very easy to link a button to a command. For instance, you could link the trigger button of a joystick to a "score" command. This class represents a subclass of Trigger that is specifically aimed at buttons on an operator interface as a common use case of the more generalized Trigger objects. This is a simple wrapper around Trigger with the method names renamed to fit the Button object use.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.wpi.first.wpilibj.buttons.Trigger |
---|
Trigger.ButtonScheduler |
Constructor Summary | |
---|---|
Button()
|
Method Summary | |
---|---|
void |
cancelWhenPressed(Command command)
Cancel the command when the button is pressed |
void |
toggleWhenPressed(Command command)
Toggles the command whenever the button is pressed (on then off then on) |
void |
whenPressed(Command command)
Starts the given command whenever the button is newly pressed. |
void |
whenReleased(Command command)
Starts the command when the button is released |
void |
whileHeld(Command command)
Constantly starts the given command while the button is held. |
Methods inherited from class edu.wpi.first.wpilibj.buttons.Trigger |
---|
cancelWhenActive, get, getSmartDashboardType, getTable, initTable, toggleWhenActive, whenActive, whenInactive, whileActive |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Button()
Method Detail |
---|
public void whenPressed(Command command)
command
- the command to startpublic void whileHeld(Command command)
Command.start()
will be called repeatedly while the button is held,
and will be canceled when the button is released.
command
- the command to startpublic void whenReleased(Command command)
command
- the command to startpublic void toggleWhenPressed(Command command)
command
- public void cancelWhenPressed(Command command)
command
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |