Lab 10 Energy Optimization Day 1 Code

Got past the gate for the first time and then attached to the additional vehicle

reverse(4); //Reverse the Polarization of both motors

 motorSpeed(4,35); //set motor speed of both motors to 35

 goFor(1); //goes at that motor speed for 1 second

 motorSpeed(4,25); //sets both motors to 25% speed

 goToRelativePosition(374); //sets the distance to run the motors for to 374 marks of current position

 brake(4); //cuts power to all 2 motors

 reverse(4); //Reverse the Polarization of both motors

 motorSpeed(4,20); // sets motor speed of both motors to 20%

 goFor(2); //has the AEV go at that speed for 2 seconds

 

 brake(4); //cuts all power to both motors

 goFor(8); //waits 8 seconds

 reverse(4);  //Reverse the Polarization of both motors

 

 motorSpeed(4,35); // sets motor speed of both motors to 35%

 goFor(1); //waits 1 seconds

 motorSpeed(4,25); // sets motor speed of both motors to 25%

 goToRelativePosition(400); //sets the distance to run the motors for to 400 marks of current position

 brake(4); //cuts all power to both motors

 reverse(4); //Reverse the Polarization of both motors

 motorSpeed(4,20); // sets motor speed of both motors to 20%

 goFor(1.5); //waits 1.5 seconds

 

 brake(4); //cuts all power to both motors

 goFor(2);  //waits 2 seconds

 motorSpeed(4,55); // sets motor speed of both motors to 55%

 goFor(1); //waits 1 seconds

 motorSpeed(4,35); // sets motor speed of both motors to 35%

 goToRelativePosition(-340); //sets the distance to run the motors for to -340 marks of current position

 brake(4); //cuts all power to both motors

 reverse(4); //Reverse the Polarization of both motors

 motorSpeed(4,25); // sets motor speed of both motors to 25%

 goFor(2); //waits 2 seconds