NextAnalogInput

constructor(initializer: () -> AnalogInput, customTransformation: (Double) -> Double = { n: Double -> n }, maxVoltage: Voltage = 3.3.volts)

Parameters

initializer

A lambda that resolves and returns the underlying AnalogInput.

customTransformation

An optional transformation applied to the normalized voltage ratio (raw voltage divided by maxVoltage) before it is exposed via value. Defaults to the identity function.

maxVoltage

The voltage that corresponds to a normalized value of 1.0. Defaults to 3.3 volts.


constructor(name: String, customTransformation: (Double) -> Double = { n: Double -> n }, maxVoltage: Voltage = 3.3.volts)

Creates a NextAnalogInput by looking up the AnalogInput in the hardware map by its configured name.

Parameters

name

The name of the analog input device as configured in the hardware map.

customTransformation

An optional transformation applied to the normalized voltage ratio before it is exposed via value. Defaults to the identity function.

maxVoltage

The voltage that corresponds to a normalized value of 1.0. Defaults to 3.3 volts.


constructor(module: NextLynxModule, channel: Int, customTransformation: (Double) -> Double = { n: Double -> n }, maxVoltage: Voltage = 3.3.volts)

Creates a NextAnalogInput directly from a NextLynxModule and analog channel number, bypassing the hardware map.

Parameters

module

The Lynx module whose analog controller the input is attached to.

channel

The analog channel index, must be in the range [0, 3].

customTransformation

An optional transformation applied to the normalized voltage ratio before it is exposed via value. Defaults to the identity function.

maxVoltage

The voltage that corresponds to a normalized value of 1.0. Defaults to 3.3 volts.

Throws

if channel is not in the range [0, 3].