Week 2 Code

Week 2 Code

Code:

void myCode(){

/*

Andy Carper, Christian Meadows, Grant Centlivre, and Kody Williamson

ENGR 1182 AEV Code – Group E

myCode();

 

This is the tab where the programming of your vehicle operation is done.

lab _00_AEV_key_words contains a compiled list of functions/subroutines used         for vehicle operation.

 

Note:

(1) After running your AEV do not turn the AEV off, connect the AEV to a computer, or push the reset button on the Arduino. There is a 13 second processing period. In post processing, data is stored and battery recuperation takes place.

(2) Time, current, voltage, total marks, position traveled are recorded approximately

every 60 milliseconds. This may vary depending on the vehicles operational tasks.

It takes approximately 35-40 milliseconds for each recording. Thus when programming, code complexity may not be beneficial.

(3) Always comment your code. Debugging will be quicker and easier to do and will especially aid the instructional team in helping you.

*/

celerate(1,0,15,2.5);  //Accelerate Motor 1 from start to 15% power in 2.5s

motorSpeed(1,15);  //Set Motor 1 speed to Motor one for 15%

goFor(1);  //Run Motor 1 for 1s

celerate(2,0,27,4);  //Accelerate Motor 2 from start to 27% power in 4s

motorSpeed(2,27);  //Set Motor 2 speed to Motor one for 27%

goFor(2.7);  //Run Motor 2 for 2.7s

celerate(2,27,15,1);  //Decelerate Motor 2 from 27% battery power to 15% power in //1s

brake(2);  //Cut power to Motor 2

reverse(2);  //Reverse the direction of Motor 2

celerate(4,0,21,2);  //Accelerate all Motors from rest to 21% battery power in 2s

motorSpeed(4,35);  //Set all Motor speeds to 35% battery power

brake(2);  //Cut power to Motor 2

motorSpeed(1,35);  //Set Motor speed 1 to 35%

goFor(3);  //Run Motor 1 for 3s

brake(1);  //Cut power to Motor 1

brake(2);  //Cut power to Motor 2

reverse(1);  //Reverse the direction of Motor 1

celerate(1,0,19,2);  //Accelerate Motor 1 from rest to 19% battery power in 2s

motorSpeed(2,35);  //Set Motor 2 speed to 35% battery power

goFor(2); //Run Motor 2 for 2s

motorSpeed(1,19);  //Set Motor 1 speed to 19% battery power

goFor(2);  //Run Motor 1 for 2s

motorSpeed(4, 19);  //Set all Motor speeds to 19% battery power

goFor(2);  //Run all motors for 2s

celerate(4,19,0,3);  //Decelerate all motors from 19% battery power to 0% battery //power in 3s

brake(1);  //Cut power to Motor 1

brake(2);  //Cut power to Motor 2

}

Comments: The code seems to be executed correctly as the motors run on different power settings for different lengths of time. It was observed that power appears to be cut to the motors at the correct time. It will be essential to understand and utilize these commands moving forward to propel the AEV forward to complete the mission statement