The code below was created to test the AEV. This was based on the scenario provided in the lab manual.
Scenario 1: PrgmBasics
celerate(1,0,15,2.5);// Accelerate motor one from start to 15% power in 2.5 seconds
motorSpeed(1,15);// Run motor one at constant speed (15% power)
goFor(1); //The first motor will run at 15% power
brake(1); // Brake motor one
celerate(2,0,27,4); // Accelerate motor two from start to 27% power in 4 seconds
motorSpeed(2,27); // Run motor two at a constant speed (27% power)
goFor(2.7); //Motor two will run at 27% power for 2.7 seconds
celerate(2,27,15,1); // Decelerate motor two to 15% power in 1 second
brake(2); // Brake motor two
reverse(2); // Reverse the direction of only motor two
celerate(4,0,31,2); // Accelerate all motors from start to 31% power in 2 seconds
motorSpeed(4,35); // Run all motors at a constant speed of 35% power for 1 second
goFor(1); // Run all four motors at 35% power for 1 second
brake(2); // Brake motor two
motorSpeed(1,35); // Run motor one at a constant speed (35% power)
goFor(3); // Run motor one at 35% power for 3 seconds
brake(4); // Brake all motors
motorSpeed(4,35); //Run all four motors at 35% power
goFor(1); // Run the previous command for 1 second
brake(4); //Brake all motors
goFor(1); // All motors will remain off for 1 second
reverse(1); // Reverse the direction of motor one
celerate(1,0,19,2); // Accelerate motor one from start to 19% power over 2 seconds
motorSpeed(2,35); // Run motor two at 35% power
motorSpeed(1,19); // Run motor one at 19% power
goFor(2); // Motor one will run at 19% power for 2 seconds
motorSpeed(2,19); // Run motor two at 19% power
goFor(2); // Run both motors at a constant speed (19% power) for 2 seconds
celerate(4,19,0,3); // Decelerate motor one to 0% power in 3 seconds
brake(4); // Brake all motors