I have a student working with Line Trackers…we where able to get them all to work on either the right or left side, but it won’t work in the middle. I have looked at the code so much I can’t see the problem. I have put the code in for anyone who would have time to take a look. Thanks!
#pragma config(Sensor, in1, sensorRight, sensorLineFollower)
#pragma config(Sensor, in4, sensorCenter, sensorLineFollower)
#pragma config(Sensor, in8, sensorLeft, sensorLineFollower)
#pragma config(Motor, port1, rightmotor, tmotorVex393_HBridge, openLoop, reversed)
#pragma config(Motor, port10, leftmotor, tmotorVex393_HBridge, openLoop, reversed)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
task main()
{
wait1Msec(2000);
int threshold = 2048;
while(true)
{
if(SensorValue (sensorRight) > threshold)
{
motor[leftmotor] = 63;
motor[rightmotor] = 0;
}
if(SensorValue (sensorCenter) > threshold)
{
motor[leftmotor] = 63;
motor[rightmotor] = 63;
}
if(SensorValue (sensorLeft) > threshold)
{
motor[leftmotor] = 0;
motor[rightmotor] = 63;
}
// else;
// {
// motor[leftmotor] = 63;
// motor[rightmotor] = 63;
// wait1Msec(0050);
// stop();
//}
//if((SensorValue (sensorLeft) < threshold) && (SensorValue (sensorRight) < threshold))
//{
// motor[leftmotor] = 63;
// motor[rightmotor] = 63;
//}
}
}