Package frc.lib
Class WritableTrigger
java.lang.Object
edu.wpi.first.wpilibj2.command.button.Trigger
frc.lib.WritableTrigger
- All Implemented Interfaces:
BooleanSupplier
A Trigger that can be manually set to true or false.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new WritableTrigger with an initial state of false.WritableTrigger(boolean initialState) Creates a new WritableTrigger with the specified initial state. -
Method Summary
Methods inherited from class edu.wpi.first.wpilibj2.command.button.Trigger
and, debounce, debounce, getAsBoolean, multiPress, negate, onChange, onFalse, onTrue, or, toggleOnFalse, toggleOnTrue, whileFalse, whileTrue
-
Constructor Details
-
WritableTrigger
public WritableTrigger()Creates a new WritableTrigger with an initial state of false. -
WritableTrigger
public WritableTrigger(boolean initialState) Creates a new WritableTrigger with the specified initial state.- Parameters:
initialState- The initial value to seed the trigger.
-
-
Method Details
-
set
public void set(boolean value) Sets the state of the trigger. If the state changes, it will fire associated commands on the next loop iteration.- Parameters:
value- The new state.
-
get
public boolean get()Gets the current state of the trigger.- Returns:
- The current state.
-
toggle
public boolean toggle()Toggles the state of the trigger.- Returns:
- The new state after toggling.
-