Toggle

class Toggle(startState: Boolean)

This class is a wrapper class for booleans, but it allows you to negate the boolean by pressing a button. The intended use case is that there is some boolean value used in an OpMode, and you want it to change every time you press a specific button on the gamepad. Make that boolean a Toggle and call toggle(boolean) every cycle using the desired button as the input to toggle()

Constructors

Link copied to clipboard
constructor(startState: Boolean)

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun toggle(button: Boolean)

Changes the state of the boolean if it hasn't been changed in the previous cycle