Code 1

//reverse motors to go forward

reverse(4);

//22% motor speed to start AEV until 238 marks
motorSpeed(4,22);
goToAbsolutePosition(238);

//at 238 marks cut all power to motors
brake(4);

//coast to 465 marks into gate
goToAbsolutePosition(465);
brake(4);

//wait 8 seconds
goFor(8);

//start at 20% motor speed after gate opens
motorSpeed(4,20);

// go to 813 marks, cut power to all motors
goToAbsolutePosition(813);
brake(4);

//coast to 1040 marks into docking station
goToAbsolutePosition(1040);
brake(4);

//wait 2 seconds

goFor(2);

//reverse motors to go backwards and start at 45% motor speed to 1300 marks

reverse(4);
motorSpeed(4,45);
goToAbsolutePosition(1300);

//cut all power to motors

brake(4);

//coast to 1522 marks

goToAbsolutePosition(1522);
brake(4);

//wait for 8 seconds
goFor(8);

//accelerate from 0 to 45 motor speed in 2 seconds
celerate(4,0,45,2);

//go at 45% motor speed until 2000 makrs
motorSpeed(4,45);
goToAbsolutePosition(2000);

// cut all power to motors and coast to end
brake(4);
goToAbsolutePosition(2095);
brake(4);