Hello,
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;
while(true)
{
int leftEncoder = SensorValue[dgtl1];
int rightEncoder = SensorValue[dgtl3];
wait1Msec(10);
}
}
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.