Programming Basics Code with Breakdown
The code below is the code the division used for testing the standard AEV model. This code was mainly used for checking if the AEV parts worked properly. Using the run completed by this code, the division learned how to obtain data from the AEV after runs and create graphs of various properties.
celerate(1,0,15,2.5); | Accelerates motor 1 from 0% to 15% in 2.5 seconds. |
motorSpeed(1,15); | Runs motor one at a constant speed at 15%. |
goFor(1); | Keeps motor one running for one second. |
brake(1); | Brakes motor one. |
celerate(2,0,27,4); | Accelerates motor two from 0% to 27% in 4 seconds |
motorSpeed(2,27); | Runs motor two at a constant speed at 27%. |
goFor(2.7); | Runs motor two at constant speed at 27% power for 2.7 seconds. |
celerate(2,27,15,1); | Decelerates motor two from 27% to 15%. |
brake(2); | Brakes motor two. |
reverse(2); | Reverses motor two. |
celerate(4,0,31,2); | Accelerate all motors from start to 31% power for 2 seconds. |
motorSpeed(4,35); | Run all motors at a constant speed at 35% power. |
goFor(1); | Runs all motors for 1 second. |
brake(2); | Brakes motor two. |
motorSpeed(1,35); | Motor one runs at 35% power. |
goFor(3); | Runs motor one for 3 seconds. |
brake(4); | Brakes all motors. |
goFor(1); | Motors stop for 1 second. |
reverse(1); | Reverses motor one. |
celerate(1,0,19,2); | Accelerates motor one from start to 19% for 2 seconds. |
motorSpeed(1,19); | Runs motor one at constant speed of 19%. |
motorSpeed(2,35); | Runs motor two at constant speed of 35%. |
goFor(2); | Runs all motors for 2 seconds. |
motorSpeed(4,19); | Runs all motors at 19% power. |
goFor(2); | Goes for 2 seconds. |
motorSpeed(4,19); | Runs motors at constant speed 19%. |
goFor(2); | Runs motors for 2 seconds. |
celerate(4,19,0,3); | Decelerates all motors from 19% to 0%. |
brake(4); | Brakes all motors. |