Hello, i have the VEX EDR Clawbot and for my class project i have to install and test 2 of the sensors. I chose the line tracker and ultrasonic range finder. im going to use the sample programs from robotC for line tracking and range finding. can anyone help me figure out how to combine the two programs so that it does both sensor tests in one run? Thanks!!
TEST: I would like for the robot to follow a line and avoid an obstacle using the line tracker, then proceed to another obstacle but this time stop 20 inches from it using the range finder sensor.
—>Also, if no one can figure that out, the line tracker program does not stop, it is continuous. can anyone help me make it so that it ends when there is no more line?
LINE TRACKER PROGRAM:
task main()
{
wait1Msec(2000);
int threshold = 3000;
while(true)
{
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
displayLCDCenteredString(0, “Light Sensor:”); // Display |
displayLCDPos(1,6); // Sensor |
displayNextLCDNumber(SensorValue(lineTracker)); // Readings |
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -+
// sensor sees light:
if(SensorValue(lineTracker) < threshold)
{
// counter-steer left:
motor[leftMotor] = 63;
motor[rightMotor] = 0;
}
// sensor sees dark:
else
{
// counter-steer right:
motor[leftMotor] = 0;
motor[rightMotor] = 63;
}
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
RANGE FINDER PROGRAM:
//+++++++++++++++++++++++++++++++++++++++++++++| MAIN |+++++++++++++++++++++++++++++++++++++++++++++++
task main()
{
wait1Msec(2000);
while(SensorValue(sonarSensor) > 20 || SensorValue(sonarSensor) == -1)
{
motor[rightMotor] = 63;
motor[leftMotor] = 63;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++