Package com.revrobotics
Class SparkMaxLimitSwitch
java.lang.Object
com.revrobotics.SparkMaxLimitSwitch
- All Implemented Interfaces:
CANDigitalInput
Get an instance of this class by using
CANSparkMax.getForwardLimitSwitch(Type) or CANSparkMax.getReverseLimitSwitch(Type).-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.revrobotics.CANDigitalInput
CANDigitalInput.LimitSwitchPolarity -
Method Summary
Modifier and TypeMethodDescriptionenableLimitSwitch(boolean enable) Enables or disables controller shutdown based on the limit switch.booleanget()Deprecated, for removal: This API element is subject to removal in a future version.booleanbooleanReturnstrueif the limit switch is pressed, based on the selected polarity.
-
Method Details
-
isPressed
Returnstrueif the limit switch is pressed, based on the selected polarity.This method works even if the limit switch is not enabled for controller shutdown.
- Returns:
trueif the limit switch is pressed
-
get
Deprecated, for removal: This API element is subject to removal in a future version.UseisPressed()insteadReturnstrueif the limit switch is pressed, based on the selected polarity.This method works even if the limit switch is not enabled.
- Specified by:
getin interfaceCANDigitalInput- Returns:
trueif the limit switch is pressed
-
enableLimitSwitch
Enables or disables controller shutdown based on the limit switch.- Specified by:
enableLimitSwitchin interfaceCANDigitalInput- Parameters:
enable- Enable/disable motor shutdown based on the limit switch state. This does not affect the result of the get() command.- Returns:
REVLibError.kOkif successful
-
isLimitSwitchEnabled
- Specified by:
isLimitSwitchEnabledin interfaceCANDigitalInput- Returns:
trueif the limit switch is enabled
-
isPressed()instead