Final Program

//Reverses polarity so AEV is in push orientation

reverse(4);

//Run at maximum motor speed until mark 155.5

motorSpeed(4,50);

goToAbsolutePosition(155.5);

//Reverses the polarity and run the motor at maximum speed for 2 seconds to brake

reverse(4);

motorSpeed(4,50);

goFor(2);

//Cut the motors for 6.6 seconds to wait for the gate to open

brake(4);

goFor(6.6);

//Reverses polarity of blades to run in correct push orientation and run at maximum motor speed for 106 marks

reverse(4);

motorSpeed(4,50);

goToRelativePosition(106);

//Cut the motors for 0.6 seconds while rolling down the ramp

brake(4);

goFor(.6);

//Reverse the polarity of the blades and run at maximum speed for 1.5 seconds to brake and attack to the caboose

reverse(4);

motorSpeed(4,50);

goFor(1.5);

//Cut the motor for 5 seconds while attached to the caboose

brake(4);

goFor(5);

//Run at maximum power in the pull orientation for 267 marks

motorSpeed(4,50);

goToRelativePosition(-267);

//Reverse the orientation and run at maximum motor speed for 1 second to brake in front of the gate

reverse(4);

motorSpeed(4,50);

goFor(1);

//Cut motors for 6.5 seconds waiting for the gate to open

brake(4);

goFor(6.5);

//Reverse the polarity so that it is in the correct pull orientation and run at maximum motor speed for 130 marks

reverse(4);

motorSpeed(4,50);

goToRelativePosition(-130);

//Cut the motors for 3.7 seconds while the AEV is rolling down the ramp

brake(4);

goFor(3.7);

//Reverse the orientation and run at a high motor speed for 1.2 seconds to stop the AEV at the end of the track to complete the test

reverse(4);

motorSpeed(4,45);

goFor(1.2);

//Test worked to completion