Hello, when the line tracker reads >1300 it won’t spin
#include "vex.h"
using namespace vex;
vex::motor ClawMotor = vex::motor(vex::PORT9);
vex::motor LeftMotor = vex::motor(vex::PORT1);
vex::motor RightMotor = vex::motor(vex::PORT14);
vex::motor Motor1 = vex::motor(vex::PORT20);
vex::motor Motor2 = vex::motor(vex::PORT7);
vex::controller Controller1 = vex::controller();
int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
while (true) {
// If the reflectivity is greater than the threshold it will move the LeftMotor forward
if (LineTrackerA.reflectivity() < 1300) {
LeftMotor.stop(brakeType::hold);
RightMotor.stop(brakeType::hold);;
} else
{
// If the reflectivity is less than the threshold it will move the RightMotor forward
LeftMotor.spin(directionType::fwd, 50, vex::velocityUnits::pct);
RightMotor.spin(directionType::rev, 50, vex::velocityUnits::pct);
}
wait(5, msec);
}
}
Place the motor stop command after the motors spin.
Right now your code turns your motors when not on the line, but never tells them to stop spinning, so they keep rotating.
You could try a rotateFor command, for example
Else{
RotateFor(12 rotations)
}
This would tell your motor to turn 12 times and stop.
Right now, from what I can tell, your code just tells your motors to turn at 50% speed