SwitchN64Controller
- class wpilib.SwitchN64Controller(*args, **kwargs)
-
Handle input from SwitchN64 controllers connected to the Driver Station.
This class handles SwitchN64 input that comes from the Driver Station. Each time a value is requested the most recent value is returned.
Overloaded function.
__init__(self: wpilib._wpilib.SwitchN64Controller, port: typing.SupportsInt | typing.SupportsIndex) -> None
Construct an instance of a controller.
The controller index is the USB port on the Driver Station.
- Parameters:
port – The port on the Driver Station that the controller is plugged into.
__init__(self: wpilib._wpilib.SwitchN64Controller, hid: wpilib._wpilib.GenericHID) -> None
Construct an instance of a controller with a GenericHID object.
- Parameters:
hid – The GenericHID object to use for this controller.
- class Axis(value: SupportsInt | SupportsIndex)
Bases:
pybind11_objectRepresents an axis on a SwitchN64Controller.
Members:
LEFT_X : Left X.
LEFT_Y : Left Y.
Z_AXIS : Z Axis.
ZR : ZR.
- LEFT_X = <Axis.LEFT_X: 0>
- LEFT_Y = <Axis.LEFT_Y: 1>
- ZR = <Axis.ZR: 5>
- Z_AXIS = <Axis.Z_AXIS: 4>
- SwitchN64Controller.Axis.name -> str
- property value
- class Button(value: SupportsInt | SupportsIndex)
Bases:
pybind11_objectRepresents a digital button on a SwitchN64Controller.
Members:
A : A button.
B : B button.
C_LEFT : C Left button.
C_UP : C Up button.
CAPTURE : Capture button.
HOME : Home button.
START : Start button.
C_DOWN : C Down button.
L : L button.
R : R button.
DPAD_UP : Dpad Up button.
DPAD_DOWN : Dpad Down button.
DPAD_LEFT : Dpad Left button.
DPAD_RIGHT : Dpad Right button.
C_RIGHT : C Right button.
- A = <Button.A: 0>
- B = <Button.B: 1>
- CAPTURE = <Button.CAPTURE: 15>
- C_DOWN = <Button.C_DOWN: 2>
- C_LEFT = <Button.C_LEFT: 3>
- C_RIGHT = <Button.C_RIGHT: 21>
- C_UP = <Button.C_UP: 4>
- DPAD_DOWN = <Button.DPAD_DOWN: 12>
- DPAD_LEFT = <Button.DPAD_LEFT: 13>
- DPAD_RIGHT = <Button.DPAD_RIGHT: 14>
- DPAD_UP = <Button.DPAD_UP: 11>
- HOME = <Button.HOME: 5>
- L = <Button.L: 9>
- R = <Button.R: 10>
- START = <Button.START: 6>
- SwitchN64Controller.Button.name -> str
- property value
- SUPPORTED_OUTPUTS = <SupportedOutputs.NONE: 0>
- SUPPORTS_MONO_LED = False
- SUPPORTS_RGB_LED = False
- SUPPORTS_RUMBLE = False
- SUPPORTS_TRIGGER_RUMBLE = False
- TOUCHPAD_COUNT = 0
- a(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the A button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the A button’s digital signal attached to the given loop.
- axis_greater_than(axis: wpilib._wpilib.SwitchN64Controller.Axis, threshold: SupportsFloat | SupportsIndex, loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance that is true when the axis value is greater than threshold.
- Parameters:
axis – The axis to read.
threshold – The value above which this event should return true.
loop – the event loop instance to attach the event to.
- Returns:
an event instance that is true when the axis value is greater than the provided threshold.
- axis_less_than(axis: wpilib._wpilib.SwitchN64Controller.Axis, threshold: SupportsFloat | SupportsIndex, loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance that is true when the axis value is less than threshold.
- Parameters:
axis – The axis to read.
threshold – The value below which this event should return true.
loop – the event loop instance to attach the event to.
- Returns:
an event instance that is true when the axis value is less than the provided threshold.
- b(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the B button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the B button’s digital signal attached to the given loop.
- button(button: wpilib._wpilib.SwitchN64Controller.Button, loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around this button’s digital signal.
- Parameters:
button – the button
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the button’s digital signal attached to the given loop.
- c_down(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the C Down button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the C Down button’s digital signal attached to the given loop.
- c_left(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the C Left button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the C Left button’s digital signal attached to the given loop.
- c_right(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the C Right button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the C Right button’s digital signal attached to the given loop.
- c_up(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the C Up button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the C Up button’s digital signal attached to the given loop.
- capture(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Capture button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Capture button’s digital signal attached to the given loop.
- dpad_down(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Dpad Down button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Dpad Down button’s digital signal attached to the given loop.
- dpad_left(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Dpad Left button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Dpad Left button’s digital signal attached to the given loop.
- dpad_right(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Dpad Right button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Dpad Right button’s digital signal attached to the given loop.
- dpad_up(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Dpad Up button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Dpad Up button’s digital signal attached to the given loop.
- get_a_button() bool
Read the value of the A button on the controller.
- Returns:
The state of the button.
- get_a_button_pressed() bool
Whether the A button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_a_button_released() bool
Whether the A button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_axis(axis: wpilib._wpilib.SwitchN64Controller.Axis) float
Get the value of the axis.
- Parameters:
axis – The axis to read
- Returns:
the axis value.
- get_b_button() bool
Read the value of the B button on the controller.
- Returns:
The state of the button.
- get_b_button_pressed() bool
Whether the B button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_b_button_released() bool
Whether the B button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_button(button: wpilib._wpilib.SwitchN64Controller.Button) bool
Get the button value.
- Parameters:
button – The button to read
- Returns:
The state of the button.
- get_button_pressed(button: wpilib._wpilib.SwitchN64Controller.Button) bool
Whether the button was pressed since the last check.
- Parameters:
button – The button to read
- Returns:
Whether the button was pressed since the last check.
- get_button_released(button: wpilib._wpilib.SwitchN64Controller.Button) bool
Whether the button was released since the last check.
- Parameters:
button – The button to read
- Returns:
Whether the button was released since the last check.
- get_c_down_button() bool
Read the value of the C Down button on the controller.
- Returns:
The state of the button.
- get_c_down_button_pressed() bool
Whether the C Down button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_c_down_button_released() bool
Whether the C Down button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_c_left_button() bool
Read the value of the C Left button on the controller.
- Returns:
The state of the button.
- get_c_left_button_pressed() bool
Whether the C Left button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_c_left_button_released() bool
Whether the C Left button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_c_right_button() bool
Read the value of the C Right button on the controller.
- Returns:
The state of the button.
- get_c_right_button_pressed() bool
Whether the C Right button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_c_right_button_released() bool
Whether the C Right button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_c_up_button() bool
Read the value of the C Up button on the controller.
- Returns:
The state of the button.
- get_c_up_button_pressed() bool
Whether the C Up button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_c_up_button_released() bool
Whether the C Up button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_capture_button() bool
Read the value of the Capture button on the controller.
- Returns:
The state of the button.
- get_capture_button_pressed() bool
Whether the Capture button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_capture_button_released() bool
Whether the Capture button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_dpad_down_button() bool
Read the value of the Dpad Down button on the controller.
- Returns:
The state of the button.
- get_dpad_down_button_pressed() bool
Whether the Dpad Down button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_dpad_down_button_released() bool
Whether the Dpad Down button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_dpad_left_button() bool
Read the value of the Dpad Left button on the controller.
- Returns:
The state of the button.
- get_dpad_left_button_pressed() bool
Whether the Dpad Left button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_dpad_left_button_released() bool
Whether the Dpad Left button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_dpad_right_button() bool
Read the value of the Dpad Right button on the controller.
- Returns:
The state of the button.
- get_dpad_right_button_pressed() bool
Whether the Dpad Right button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_dpad_right_button_released() bool
Whether the Dpad Right button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_dpad_up_button() bool
Read the value of the Dpad Up button on the controller.
- Returns:
The state of the button.
- get_dpad_up_button_pressed() bool
Whether the Dpad Up button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_dpad_up_button_released() bool
Whether the Dpad Up button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_hid() wpilib._wpilib.GenericHID
Get the underlying GenericHID object.
- Returns:
the wrapped GenericHID object
- get_home_button() bool
Read the value of the Home button on the controller.
- Returns:
The state of the button.
- get_home_button_pressed() bool
Whether the Home button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_home_button_released() bool
Whether the Home button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_l_button() bool
Read the value of the L button on the controller.
- Returns:
The state of the button.
- get_l_button_pressed() bool
Whether the L button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_l_button_released() bool
Whether the L button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_left_x() float
Get the Left X value of the controller.
- Returns:
the axis value.
- get_left_y() float
Get the Left Y value of the controller.
- Returns:
the axis value.
- get_port() int
Get the port number of the HID.
- Returns:
The port number of the HID.
- get_r_button() bool
Read the value of the R button on the controller.
- Returns:
The state of the button.
- get_r_button_pressed() bool
Whether the R button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_r_button_released() bool
Whether the R button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_start_button() bool
Read the value of the Start button on the controller.
- Returns:
The state of the button.
- get_start_button_pressed() bool
Whether the Start button was pressed since the last check.
- Returns:
Whether the button was pressed since the last check.
- get_start_button_released() bool
Whether the Start button was released since the last check.
- Returns:
Whether the button was released since the last check.
- get_z_axis() float
Get the Z Axis value of the controller.
- Returns:
the axis value.
- get_zr() float
Get the ZR value of the controller.
- Returns:
the axis value.
- home(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Home button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Home button’s digital signal attached to the given loop.
- init_sendable(builder: wpiutil._wpiutil.SendableBuilder) None
- is_connected() bool
Get if the HID is connected.
- Returns:
true if the HID is connected
- l(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the L button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the L button’s digital signal attached to the given loop.
- r(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the R button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the R button’s digital signal attached to the given loop.
- set_leds(r: SupportsInt | SupportsIndex, g: SupportsInt | SupportsIndex, b: SupportsInt | SupportsIndex) None
Set leds on the controller.
- Parameters:
r – Red value from 0-255
g – Green value from 0-255
b – Blue value from 0-255
- set_rumble(type: wpilib._wpilib.GenericHID.RumbleType, value: SupportsFloat | SupportsIndex) None
Set the rumble output for the HID.
- Parameters:
type – Which rumble value to set
value – The normalized value (0 to 1) to set the rumble to
- start(loop: wpilib._wpilib.EventLoop) wpilib._wpilib.BooleanEvent
Constructs an event instance around the Start button’s digital signal.
- Parameters:
loop – the event loop instance to attach the event to.
- Returns:
an event instance representing the Start button’s digital signal attached to the given loop.