The robot just drives forward and doesn’t follow the line
#pragma config(Sensor, in1, LineFollowerRight, sensorLineFollower)
#pragma config(Sensor, in2, LineFollowerLeft, sensorLineFollower)
#pragma config(Sensor, dgtl1, LeftClaw, sensorTouch)
#pragma config(Sensor, dgtl2, RightClaw, sensorTouch)
#pragma config(Sensor, dgtl3, CallButtonFront, sensorTouch)
#pragma config(Sensor, dgtl6, BInput, sensorSONAR_cm)
#pragma config(Sensor, dgtl8, CallButtonBack, sensorTouch)
#pragma config(Sensor, dgtl10, FInput, sensorSONAR_cm)
#pragma config(Motor, port2, LeftBack, tmotorVex393_MC29, openLoop, driveLeft)
#pragma config(Motor, port4, Claw, tmotorVex393_MC29, openLoop)
#pragma config(Motor, port6, RightBack, tmotorVex393_MC29, openLoop, reversed, driveRight)
#pragma config(Motor, port8, RightFront, tmotorVex393_MC29, openLoop, reversed, driveRight)
#pragma config(Motor, port9, LeftFront, tmotorVex393_MC29, openLoop, driveLeft)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
task main()
{
//Code for the Claw
while(1==1)
{
if(SensorValue[LeftClaw]== 1)
{
motor(Claw) = -50;
}
if(SensorValue[RightClaw] == 1)
{
motor(Claw) = 50;
}
if (SensorValue[RightClaw]== 0 && SensorValue[LeftClaw] == 0)
{
motor(Claw) = 0;
}
//Line Follower Code /////////////////////////////
if(SensorValue[CallButtonFront] == 1)//BAFDDFDDD
{
if (SensorValue[LineFollowerRight] <= 1000)
{
//turn left
motor(RightBack)= 0;
motor(RightFront)= 0;
motor(LeftBack)= 20;
motor(LeftFront) = 20;
}
if (SensorValue[LineFollowerLeft] <=1000)
{
//turn right
motor(RightBack)= 20;
motor(RightFront)= 20;
motor(LeftBack)= 0;
motor(LeftFront) = 0;
}
//go straight
if (SensorValue[LineFollowerLeft] && SensorValue[LineFollowerRight] >=1000)
{
motor(RightBack)= 20;
motor(RightFront)= 20;
motor(LeftBack)= 20;
motor(LeftFront) = 20;
}
}
}
}