ExpansionHub
- class wpilib.ExpansionHub(usb_id: SupportsInt | SupportsIndex)
Bases:
pybind11_objectThis class controls a REV ExpansionHub plugged in over USB to Systemcore.
Constructs a new ExpansionHub for a given USB ID
Multiple instances can be constructed, but will point to the same backing object with a ref count.
- Parameters:
usb_id – The USB Port ID the hub is plugged into.
- NUM_MOTOR_PORTS = 4
- NUM_SERVO_PORTS = 6
- NUM_USB_PORTS = 4
- get_usb_id() int
Gets the USB ID of this hub.
- Returns:
The USB ID
- is_hub_connected() bool
Gets if the hub is currently connected over USB.
- Returns:
True if hub connection, otherwise false
- make_cr_servo(channel: SupportsInt | SupportsIndex) wpilib._wpilib.ExpansionHubCRServo
- make_motor(channel: SupportsInt | SupportsIndex) wpilib._wpilib.ExpansionHubMotor
Constructs a motor at the requested channel on this hub.
Only a single instance of each motor per hub can be constructed at a time.
- Parameters:
channel – The motor channel
- Returns:
Motor object
- make_servo(channel: SupportsInt | SupportsIndex) wpilib._wpilib.ExpansionHubServo
Constructs a servo at the requested channel on this hub.
Only a single instance of each servo per hub can be constructed at a time.
- Parameters:
channel – The servo channel
- Returns:
Servo object