My program works, but only most of the time. Why?
What happens?
So my code is supposed to shoot two balls in different locations, but sometimes it misses for no apparent reason. Here’s my code if you want (for standard VEX Turning Point):
#pragma config(StandardModel, “VEX Launchbot”)
//!!Code automatically generated by ‘ROBOTC’ configuration wizard !!//
void shoot(){
moveMotorTarget(leftIntakeMotor, 500, 100, true);
moveMotorTarget(rightIntakeMotor, 500, 100, true);
moveMotorTarget(loadMotor, -500, 100, true);
wait(.1, seconds);
}
void load (){
moveMotorTarget(leftIntakeMotor, -5000, 100, true);
moveMotorTarget(rightIntakeMotor, -5000, 100, true);
moveMotorTarget(loadMotor, 5000, 100, true);
wait(.5, seconds);
}
task main()
{
forward(.75);
turnLeft(.75);
forward(2);
moveMotor(armMotor,100,degrees,-127);
load();
shoot();
wait(1, seconds);
moveMotor(armMotor,90,degrees,127);
turnRight(.93);
forward(1);
load();
backward(.75);
turnLeft(.375);
forward(.75);
load();
backward(1.5);
turnLeft(.45);
moveMotor(armMotor, 112, degrees, -127);
load();
shoot();
turnRight(.25);
load();
shoot();
wait(1,seconds);
moveMotor(armMotor, 112, degrees, 127);
forward(.9);
turnLeft(.28);
turnRight(.75);
}
If it is just a case of missing by a small amount it might not be the code it could just be the motors being inconsistent or some other small factor.