Analog Inputs
NextAnalogInput is a wrapper around an analog input that gives you convenient access to different readings.
It inherits from AnalogFeedback, so any NextAnalogInput can also be passed directly as the feedback source for a feedback servo.
Creating a NextAnalogInput
Section titled “Creating a NextAnalogInput”// By Lynx Module and channel, recommendedval input = NextAnalogInput(RobotController.controlHub, 0)
// Using your configuration nameval input = NextAnalogInput("armEncoder")// By Lynx Module and channel, recommendedNextAnalogInput input = new NextAnalogInput(RobotController.controlHub(), 0);
// Using your configuration nameNextAnalogInput input = new NextAnalogInput("armEncoder");Both constructors accept two optional parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
customTransformation |
(Double) -> Double |
Value Unchanged | An optional transformation applied to the normalized voltage ratio. |
maxVoltage |
Voltage |
3.3.volts |
The voltage that corresponds to a normalized value of 1.0. |
rawVoltage
Section titled “rawVoltage”Voltage this is the raw, untransformed voltage currently read from the analog input.
val voltage = input.rawVoltageVoltage voltage = input.getRawVoltage();Double the normalized reading, starting as rawVoltage then divided by your maxVoltage and passed through your customTransformation.
val normalized = input.valuedouble normalized = input.getValue();
