Talon SRX Mag Encoder for Swerve

Our robotics team are currently using 8 Falcon 500s motors for swerve drive. Additionally we have 4 SRX Mag Encoders that are linked to PWM on the DIO ports of the RoboRio. We used PWM because we do not have enough space to plug in A and B signal wires for quadrature encoders. Is there any way to use our SRX Mag Encoders as absolute encoders in our swerve? Thanks!

Use the DutyCycleEncoder class in WPIlib: DutyCycleEncoder (WPILib API 2020.3.2-60-g3011ebe)

You’ll need to wire the PWM pin (pin 9 IIRC) to a DIO to use it. Don’t forget 5V and GND.

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