External Sensors

Outer Track Code

// Run all motors at a constant speed of 25% power for 2 seconds.

motorSpeed(4,25);

goFor(2);

// Run all motors at a constant speed of 20% and using the goToAbsolutePosition function travel a total distance of 16 feet (from the starting point).

motorSpeed(4,20);

goToAbsolutePosition(394);

// Reverse motors.

reverse(4);

// Run all motors at a constant speed of 30% power for 1.5 second.

motorSpeed(4,30);

goFor(1.5);

// Brake all motors.

brake(4);

 

Inner Track Code

// Run all motors at a constant speed of 25% power for 2 seconds

motorSpeed(4,25);

goFor(2);

// Run all motors at a constant speed of 20% and using the goToAbsolutePosition function travel a total distance of 13.5 feet (from the starting point).

motorSpeed(4,20);

goToAbsolutePosition(332);

// Reverse the motors.

reverse(4);

// Run all motors at a constant speed of 30% power for 1 second.

motorSpeed(4,30);

goFor(1);

// Brake all motors.

brake(4);