This program is not working. I compile and download and it runs the autonomous mode, but as soon as it finishes what I need the robot to do there, the controler doesn't start working. I need help as soon as possible!!!
#pragma config(Sensor, in1, lineTrackerLeft, sensorLineFollower)
#pragma config(Sensor, in2, lineTrackerCenter, sensorLineFollower)
#pragma config(Sensor, in3, lineTrackerRight, sensorLineFollower)
#pragma config(Sensor, dgtl4, limitSwitch, sensorTouch)
#pragma config(Motor, port2, rightMotor, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port3, leftMotor, tmotorNormal, openLoop)
#pragma config(Motor, port4, rightElbow, tmotorNormal, openLoop, reversed)
#pragma config(Motor, port5, leftElbow, tmotorNormal, openLoop)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
task main()
{
startMotor (rightElbow, -40);
startMotor (leftElbow, -40); // move arm down
untilTouch (limitSwitch); // stop arm when limit switch is hit
stopMotor (rightElbow); // stop motor
stopMotor (leftElbow);
wait(5); // wait 5 seconds
startMotor (rightMotor, 127);
startMotor (leftMotor, 127); // move forward at full speed
wait (5); // wait 5 seconds
stopMotor (rightMotor);
stopMotor (leftMotor); // stop forward motion
** start of romote control**
while (vexRT [Btn7D] ==0) // wait untiil down button in group 7 is pressed to start remote control section of program
{
}
motor(rightMotor) = vexRT (Ch2); // right wheel = right joystick vertical motion
motor(leftMotor) = vexRT (Ch3); // left wheel = left joystick vertical motion
if(vexRT [Btn6D] == 1)
{
motor [rightElbow] = -65; // right motor controling arm moves down when down button in group 6 is pressed
}
else if(vexRT [Btn6U] == 1)
{
motor [rightElbow] = 65; // right motor controling arm moves up when up button in group 6 is pressed
}
else
{
motor [rightElbow] = 0; // when no group 6 button is pressed, no motion in right arm motor
}
if(vexRT [Btn5D] == 1)
{
motor [leftElbow] = -65; // left motor controling arm moves down when down button in group 7 is pressed
}
else if(vexRT [Btn5U] == 1)
{
motor [leftElbow] = 65; // left motor controling arm moves up when up button in group 7 is pressed
}
else
{
motor [leftElbow] = 0; // when no group 7 button is pressed, no motion in left arm motor
}
}