Quadrature Encoders Problem

I am trying to use two quadrature encoders with robotc v2.31. Here is my code:

#pragma config(Sensor, dgtl1,  right,               sensorQuadEncoder)
#pragma config(Sensor, dgtl3,  left,                sensorQuadEncoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

task main()
  SensorValue[left] = 0;
  SensorValue[right] = 0;
    int leftEncoder = SensorValue[dgtl1];
    int rightEncoder = SensorValue[dgtl3];

I am having a problem reading the second encoder (left) value. I have manually swapped the pragma statements so that the left encoder is on the top. I am then only able to read the left encoder. Which ever encoder is not first, pulses (like it is raw data) from 1 to 0. I am running this code on a Cortex (without the VEXnet “hump”). I have tried all of the sample code and they all have the same problem.

Any help would be greatly appreciated.

try flipping which wires you have plugged in. So like the 2 wires that are on the quad encoder, just take the one in port 2 and put it in port 1 and port 1 into port 2, or whichever sensor is having the problem. That works for me sometimes. Also, in you code you could just say

int leftEncoder = SensorValue[left]; 

It should work. Couple of things to try.

  1. Make sure connections are correct, is real easy to offset everything by one position, perhaps just connect one encoder at a time to simplify connections.

  2. V2.32 is the latest release of RobotC, there’s always a chance there was a bug in 2.31, perhaps upgrade to be on the safe side.

The weird thing is… I can swap the two wires and it will do the same thing. Also as I mentioned, I can swap the pragmas and the opposite one will work. The club I’m in has a building licence so I cant upgrade to the newest version.