Interface AnalogInput

All Known Implementing Classes:
SparkMaxAnalogSensor

public interface AnalogInput
Get an instance of this interface by using CANSparkMax.getAnalog(SparkMaxAnalogSensor.Mode).
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Get the position of the sensor.
    double
    Get the current conversion factor for the position of the analog sensor.
    double
    Get the voltage of the analog sensor.
    Set the conversion factor for the position of the analog sensor.
  • Method Details

    • getVoltage

      double getVoltage()
      Get the voltage of the analog sensor.
      Returns:
      Voltage of the sensor.
    • getPosition

      double getPosition()
      Get the position of the sensor. Returns value in the native unit of 'volt' by default, and can be changed by a scale factor using setPositionConversionFactor().
      Returns:
      Position of the sensor
    • setPositionConversionFactor

      Set the conversion factor for the position of the analog sensor. By default, revolutions per volt is 1. Changing the position conversion factor will also change the position units.
      Parameters:
      factor - The conversion factor which will be multiplied by volts
      Returns:
      REVLibError.kOk if successful
    • getPositionConversionFactor

      Get the current conversion factor for the position of the analog sensor.
      Returns:
      Analog position conversion factor