Encoder don't want to work

Hi there. Our team want to use Encoders in next project. We use Victors SPX so we plug them into PWM ports and try to do something but actualy they don’t want to work with us. In smartdashbouard nothing change …
some code
Encoder encoder1;
Counter licz;

double diameter = 6/12; // 6 inch wheels
double dist =0.5*3.14/1024; // ft per pulse

     encoder1 = new Encoder(0, 1, false, Encoder.EncodingType.k4X);
    licz = new Counter(5);

 SmartDashboard.putNumber("Encoder Ticks", encoder1.get());
SmartDashboard.putNumber("Distance", encoder1.getDistance());

I’ve always used DIO for encoders, not PWM fwiw

1 Like

The PWM ports on the roboRIO are purely for PWM output. To read the rise and fall of a quadrature encoder (on a roboRIO), you need to use two DIO ports (one per quadrature channel.)

1 Like