Lab 01 Code

celerate(1,0,15,2.5); //accelerate motor 1 from 0 to 15% over 2.5 seconds

 goFor(1); //go at speed 15% for 1 second

 brake(1); // break motor 1

 celerate(2,0,27,4); //accelerate motor 2 from 0 to 27% over 4 seconds

 goFor(2.7); // constant speed of 27% for 2.7 seconds

 celerate(2,27,15,1); //decellerate motor 2 from 27% to 15% over 1 second

 brake(2); //break motor 2

 reverse(2); // reverse the direction of motor 2

 celerate(4,0,31,2); // accelerate all motors to 31% over 2 seconds

 motorSpeed(4,35); // set all motors to 35% speed

 goFor(1); // keep constant speed for 1 second

 brake(2); // break motor 2

 goFor(3); // keep constant speed for 3 seconds

 brake(4); // break all motors

 goFor(1); // constant speed of 0 for 1 second

 reverse(1); // reverse motor 1 direction

 celerate(1,0,19,2); // accelerate motor 1 from 0 to 19% over 2 seconds

 motorSpeed(2,35); // set motor 2 speed to 35

 goFor(2); // keep this constant speed for 2 seconds

 motorSpeed(4,19); // set all motors to 19%

 goFor(2); // keep this speed for 2 seconds

 celerate(4,19,0,3); // decellerate all motors from 19 to 0 over 3 seconds

 brake(4); // break all motors