Skip to content

Toggles.

CTT edited this page May 10, 2019 · 1 revision

Toggles

private Toggle ********;

Basic Overview

Toggles are an essential part of the 2019 robot code, allowing the driver and manipulator to have accurate control over the scoring functions. Essentially a toggle is like a light switch, which has two states ON and OFF EX:

On state:

|-------|
| >ON<  |
|       |
|  OFF  |
|-------|

Toggle.isInOnState() returns true Toggle.isInOffState() returns false

Off state:

|-------|
|  ON   |
|       |
| >OFF< |
|-------|

Toggle.isInOnState() returns false Toggle.isInOffState() returns true

There is one more toggle function that is used in the code, Toggle.update(). Now, to change the state of a toggle, the input has to be different from the last. Ex:

Toggle = new Toggle("boolean here is if to start in an ON state"); Toggle = new Toggle(false);

|-------|
|  ON   |
|       |
| >OFF< |
|-------|

Toggle.update(true);

Clone this wiki locally