ExpansionHub

class wpilib.ExpansionHub(usbId: SupportsInt | SupportsIndex)

Bases: pybind11_object

This 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:

usbId – The USB Port ID the hub is plugged into.

NumMotorPorts = 4
NumServoPorts = 6
NumUsbPorts = 4
getUsbId() int

Gets the USB ID of this hub.

Returns:

The USB ID

isHubConnected() bool

Gets if the hub is currently connected over USB.

Returns:

True if hub connection, otherwise false

makeCRServo(channel: SupportsInt | SupportsIndex) wpilib._wpilib.ExpansionHubCRServo
makeMotor(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

makeServo(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