Arduino Code Development Update

Previous AEV Development Code from Lab 1 & 2

 

celerate(1,0,15,2.5);

//accelerates motor 1 from 0% to 15% power in 5 seconds

 motorSpeed(1,15);

//holds motor 1 at 15% power

 brake(1);

//cuts power to motor 1

 celerate(2,0,27,4);

//accelerates motor 2 from 0% to 27% power in 4 seconds

 motorSpeed(2,27);

//holds motor 2 at 27%

 goFor(2.7);

//runs the previous command fro 2.7 seconds

 celerate(2,27,15,1);

//accelerates motor 2 from 27% to 15% power in 1 second

 brake(2);

//cuts power to motor 2

 reverse(2);

//reverses the polarity of motor 2

 celerate(4,0,31,2);

//runs both motors from 0% to 31% power in 2 seconds(spinning in opposite directions)

 motorSpeed(4,35);

//holds both motors at 35% power

 goFor(1);

//previous command for 1 second

 motorSpeed(1,35);

//holds motor 1 at 35% power

 goFor(3);

//previous command for 3 seconds

 brake(2);

//cuts power to motor 2

 brake(4);

//cuts power to both motors

 goFor(1);

 reverse(1);

//reverses polarity on motor 1

 celerate(1,0,19,2);

 motorSpeed(1,19);

//holds motor 1 at 19% power

 motorSpeed(2,35);

//holds motor 2 at 35% power(both spinning the same way)

 goFor(2);

 motorSpeed(4,19);

 goFor(2);

 celerate(4,19,0,3);

 brake(4);

//cuts power to both motors

 

External Sensors Outside-

 

motorSpeed(4,25);

//holds both motors at 25% power

 goFor(2);

//previous command for 2 seconds

 motorSpeed(4,20);

//holds both motors at 20% power

 goToAbsolutePosition(295);

//after the wheel has travelled 295 marks the code moves to the next command

 reverse(4);

//reverses the polarity on both motors

 motorSpeed(4,30);

//both motors spin in the opposite direction at 30% power

 goFor(1.5);

 brake(4);

//cuts power to both motors