Hi guys i am a new member to vex and robotc and we have been doing autonomous using timing but my team decided that we should sensors. So when i was trying to learn how to use shaft encoders but the the motor keeps on going this is my code and please help me with this and absolute value stuff i really dont get it
task main()
{
wait1Msec(2000); // 2 Second Delay
//Clear Encoders
SensorValue[motorencoder] = 0;
while(SensorValue[motorencoder] < 1500) // While less than 5 rotations on the leftEncoder…
{
//…Move Forward
motor[rightmotor] = 127;
}
wait1Msec(2000);
SensorValue[motorencoder] = 0;
while(SensorValue[motorencoder] < 1500) // While less than 5 rotations on the leftEncoder…
{
//…Move Forward
motor[rightmotor] = -127;
}
SensorValue[motorencoder] = 0;
}
Thanks in advance