Class ExpansionHub
java.lang.Object
org.wpilib.hardware.expansionhub.ExpansionHub
- All Implemented Interfaces:
AutoCloseable
This class controls a REV ExpansionHub plugged in over USB to Systemcore.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes an ExpansionHub object.intgetUsbId()Gets the USB ID of this hub.booleanGets if the hub is currently connected over USB.makeMotor(int channel) Constructs a motor at the requested channel on this hub.makeServo(int channel) Constructs a servo at the requested channel on this hub.
-
Constructor Details
-
ExpansionHub
Constructs a new ExpansionHub for a given USB IDMultiple 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.
-
-
Method Details
-
close
Closes an ExpansionHub object. Will not close any other instances until the last instance is closed.- Specified by:
closein interfaceAutoCloseable
-
makeServo
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
-
makeMotor
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
-
isHubConnected
Gets if the hub is currently connected over USB.- Returns:
- True if hub connection, otherwise false
-
getUsbId
-