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 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.boolean
get()
Deprecated, for removal: This API element is subject to removal in a future version.boolean
boolean
Returnstrue
if the limit switch is pressed, based on the selected polarity.
-
Method Details
-
isPressed
Returnstrue
if 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:
true
if the limit switch is pressed
-
get
Deprecated, for removal: This API element is subject to removal in a future version.UseisPressed()
insteadReturnstrue
if the limit switch is pressed, based on the selected polarity.This method works even if the limit switch is not enabled.
- Specified by:
get
in interfaceCANDigitalInput
- Returns:
true
if the limit switch is pressed
-
enableLimitSwitch
Enables or disables controller shutdown based on the limit switch.- Specified by:
enableLimitSwitch
in 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.kOk
if successful
-
isLimitSwitchEnabled
- Specified by:
isLimitSwitchEnabled
in interfaceCANDigitalInput
- Returns:
true
if the limit switch is enabled
-
isPressed()
instead