Trouble with SparkMaxRelativeEncoder vs. RelativeEncoder

Create a drive motor using CANSparkMax call it frontLeftDriveMotor.

Declare SparkMaxRelativeEncoder frontLeftEncoder;

call
frontLeftEncoder=frontLeftDriveMotor.getEncoder(SparkMaxRelativeEncoder.Type.kHallSensor,42);

Problem is that the function call returns a RelativeEncoder object.
“Cannot convert from RelativeEncoder to SparkMaxRelativeEncoder”.
When I declare the encoder as a RelativeEncoder I get the message that it cannot be resolved as a type.

Not sure how to access, specify, etc., the encoder of the SparkMax/NEOS.

False Alarm: Didn’t import the necessary library, e.g., RelativeEncoder.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.