Package com.revrobotics
Class SparkMaxLimitSwitch
- java.lang.Object
-
- com.revrobotics.SparkMaxLimitSwitch
-
- All Implemented Interfaces:
CANDigitalInput
public class SparkMaxLimitSwitch extends java.lang.Object implements CANDigitalInput
Get an instance of this class by usingCANSparkMax.getForwardLimitSwitch(Type)
orCANSparkMax.getReverseLimitSwitch(Type)
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SparkMaxLimitSwitch.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.
- 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
- 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
- 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
- Returns:
true
if the limit switch is enabled
-
-