Class CANDigitalInput

  • public class CANDigitalInput
    extends java.lang.Object
    • Constructor Detail

      • CANDigitalInput

        public CANDigitalInput​(CANSparkMax device,
                               CANDigitalInput.LimitSwitch limitSwitch,
                               CANDigitalInput.LimitSwitchPolarity polarity)
        Constructs a CANDigitalInput.
        device - The Spark Max to which the limit switch is attached.
        limitSwitch - Whether this is forward or reverse limit switch.
        polarity - Whether the limit switch is normally open or normally closed.
    • Method Detail

      • get

        public boolean get()
        Get the value from a digital input channel. Retrieve the value of a single digital input channel from a motor controller. This method will return the state of the limit input based on the selected polarity, whether or not it is enabled.
        The state of the limit switch based on the configured polarity
      • enableLimitSwitch

        public CANError enableLimitSwitch​(boolean enable)
        Enables or disables controller shutdown based on limit switch.
        enable - Enable/disable motor shutdown based on limit switch state. This does not effect the result of the get() command.
        CANError Set to CANError::kOk if successful
      • isLimitSwitchEnabled

        public boolean isLimitSwitchEnabled()
        True if limit switch is enabled