Autonomous running for too long!

Throughout the competition I’m participating in, I’ve have a problem with my autonomous. It runs for too long and only stops at the 15 second mark though it’s not supposed to do that. Here’s my code:

task autonomous()
{
 	motor[port6] = 127;
	motor[port5] = -127;
	wait1Msec(1500);
	motor[port6] = -127;
	motor[port5] = 127;
	wait1Msec(1250);
}

The specific problem I’m occurring is the part where the port6 Motor is set to -127 and the port5 Motor is set to 127. I set that function to run for a second and a quarter but for some reason it runs for the whole duration of the autonomous round.

If anybody can dissect this and tell me what’s wrong I’d be glad. Thank you OWO

Since you never tell the motors to stop it’ll keep running even after the code has finished executing.

4 Likes

Is this good?

	motor[port6] = 127;
	motor[port5] = -127;
	wait1Msec(1500);
	motor[port6] = -127;
	motor[port5] = 127;
	wait1Msec(1250);
	motor[port6] = 0;
	motor[port5] = 0;
	wait1Msec(1000);

Yup! You shouldn’t need the last wait but it won’t hurt to have it

3 Likes

Pretty epic bro. Thanks!

1 Like