robotpy_ext.control package
robotpy_ext.control.toggle module
- class robotpy_ext.control.toggle.Toggle(joystick, button, debounce_period=None)[source]
Utility class for joystick button toggle
Usage:
foo = Toggle(joystick, 3) if foo: toggleFunction() if foo.on: onToggle() if foo.off: offToggle()
- Parameters:
joystick (
Joystick
) –wpilib.Joystick
that contains the button to togglebutton (
int
) – Number of button that will act as toggle. Same value used in getRawButton()debounce_period (
float
) – Period in seconds to wait before registering a new button press.
- property off
Equates to true if toggle is in the ‘off’ state
- property on
Equates to true if toggle is in the ‘on’ state