Software
Python
from wpilib import AnalogEncoder
analogPort = 0 # 0, 1, 2, 3
encoder = AnalogEncoder(analogPort)
print(encoder.getAbsolutePosition())
Java
public AnalogEncoder(AnalogInput analogInput) {
m_analogInput = analogInput;
init();
}
* Get the encoder value since the last reset.
*
* <p>This is reported in rotations since the last reset.
*
* @return the encoder value in rotations
*/
public double get() {
if (m_simPosition != null) {
return m_simPosition.get();
}
Last updated