Skip to content

ToggleBooleanSupplier

David Muchow edited this page Dec 24, 2022 · 2 revisions

ToggleBooleanSupplier

What is it?

The ToggleBooleanSupplier class is a class used to create what is essentially a BooleanSupplier but on a toggle and debounce system. This makes it so you can read JoystickButton values from anywhere via this class, and it will be protected by the debounce.

How do I use it?

To use it, you have to once again call a method on a ControllerAIO instance. There is only one constructor for this:

  • ToggleBooleanSupplier supplier = ControllerAIO.getToggleBooleanSupplier(JoystickButtonID id, double debounce): This creates a new boolean supplier with the id and debounce supplied. The debounce itself actually means that the button cannot be repressed again after it is pressed for however long is given. This is to avoid the 20ms loop seeing the same button press as 4-5 button presses.

This class has only one method and it is getValue(). This method will just return the toggled boolean.

Clone this wiki locally