Lab 10 Energy Optimization Day 2 Code

  Got the additional vehicle and stopped at the gate on the way back

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

 goToAbsolutePosition(380); //sets the distance to run the motors for to 380 marks of absolute position

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

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

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

 goFor(2); //waits 2 seconds

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

 goFor(8); //waits 8 seconds

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

 

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

 goFor(1); //waits 1 seconds

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

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

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

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

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

 goFor(1.5); //waits 1.5 seconds

 

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

 goFor(4); //waits 4 seconds

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

 goFor(2); //waits 2 seconds

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

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

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

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

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

 goFor(3.5); //waits 3.5 seconds

/*

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

 goFor(8); //waits 8 seconds

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

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

 goFor(1); //waits 1 seconds

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

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

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

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

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

 goFor(2); //waits 2 seconds