This is just an FYI.
I was working with the “ROBOTC VEX Cortex Default.c” sample file today (porting to you know what) and found it has a small bug.
Most (but not all, some are correct) statements using analog sensor values are using variables as an index rather than the analog port definitions. This means limit switches do not always work correctly. For example,
In this code
if((SensorValue[ana_6] < 200 && vexRT[Ch3Xmtr2] > 0) || (SensorValue[ana_5] < 200 && vexRT[Ch3Xmtr2] < 0))
{
motor[Mech3] = 0;
}
else
{
motor[Mech3] = vexRT[Ch3Xmtr2]; // up = CW
}
ana_6 should be ana6, ana_5 should be ana5.
if((SensorValue[ana6] < 200 && vexRT[Ch3Xmtr2] > 0) || (SensorValue[ana5] < 200 && vexRT[Ch3Xmtr2] < 0))
{
motor[Mech3] = 0;
}
else
{
motor[Mech3] = vexRT[Ch3Xmtr2]; // up = CW
}