class wpilib.AnalogPotentiometer(channel, fullRange=1.0, offset=0.0)[source]

Bases: wpilib.LiveWindowSendable

Reads a potentiometer via an AnalogInput

Analog potentiometers read in an analog voltage that corresponds to a position. The position is in whichever units you choose, by way of the scaling and offset constants passed to the constructor.

AnalogPotentiometer constructor.

Use the fullRange and offset values so that the output produces meaningful values. I.E: you have a 270 degree potentiometer and you want the output to be degrees with the halfway point as 0 degrees. The fullRange value is 270.0(degrees) and the offset is -135.0 since the halfway point after scaling is 135 degrees.

  • channel (int or AnalogInput) – The analog channel this potentiometer is plugged into.
  • fullRange (float) – The scaling to multiply the fraction by to get a meaningful unit. Defaults to 1.0 if unspecified.
  • offset (float) – The offset to add to the scaled value for controlling the zero value. Defaults to 0.0 if unspecified.

Get the current reading of the potentiometer.

Returns:The current position of the potentiometer.
Return type:float

Implement the PIDSource interface.

Returns:The current reading.
Return type:float