Package com.revrobotics
Class SparkLimitSwitch
- java.lang.Object
-
- com.revrobotics.SparkLimitSwitch
-
- All Implemented Interfaces:
CANDigitalInput
,SparkMaxLimitSwitch
public class SparkLimitSwitch extends java.lang.Object implements SparkMaxLimitSwitch
Get an instance of this class by usingCANSparkBase.getForwardLimitSwitch(Type)
orCANSparkBase.getReverseLimitSwitch(Type)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SparkLimitSwitch.Type
-
Nested classes/interfaces inherited from interface com.revrobotics.CANDigitalInput
CANDigitalInput.LimitSwitchPolarity
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description REVLibError
enableLimitSwitch(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.UseisPressed()
insteadboolean
isLimitSwitchEnabled()
boolean
isPressed()
Returnstrue
if the limit switch is pressed, based on the selected polarity.
-
-
-
Method Detail
-
isPressed
public boolean 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.
- Specified by:
isPressed
in interfaceSparkMaxLimitSwitch
- Returns:
true
if the limit switch is pressed
-
get
@Deprecated(forRemoval=true) public boolean 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
- Specified by:
get
in interfaceSparkMaxLimitSwitch
- Returns:
true
if the limit switch is pressed
-
enableLimitSwitch
public REVLibError enableLimitSwitch(boolean enable)
Enables or disables controller shutdown based on the limit switch.- Specified by:
enableLimitSwitch
in interfaceCANDigitalInput
- Specified by:
enableLimitSwitch
in interfaceSparkMaxLimitSwitch
- 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
public boolean isLimitSwitchEnabled()
- Specified by:
isLimitSwitchEnabled
in interfaceCANDigitalInput
- Specified by:
isLimitSwitchEnabled
in interfaceSparkMaxLimitSwitch
- Returns:
true
if the limit switch is enabled
-
-