Package com.revrobotics
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 TypeMethodDescriptiondoubleGet the position of the sensor.doubleGet the current conversion factor for the position of the analog sensor.doubleGet the voltage of the analog sensor.setPositionConversionFactor(double factor) 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.kOkif successful
-
getPositionConversionFactor
double getPositionConversionFactor()Get the current conversion factor for the position of the analog sensor.- Returns:
- Analog position conversion factor
-