Arduino Code Glossary:
celerate(m,p1,p2,t); – Accelerates or decelerates motor(s) m from start speed (%) p1 to end speed (%) p2 over a duration of t seconds
motorSpeed(m,p); – Initializes motor(s) m at percent power p
goFor(t); – Runs the motor(s) at their initialized state for t seconds
brake(m); – Brakes motor(s) m Note: This does NOT brake the AEV, just stops the motors from spinning
reverse(m); – Reverses the polarity of motor(s) m
goToRelativePosition(n); – Continues the previous command for n marks from the vehicle’s current position. n can be positive or negative, with positive meaning the vehicle is moving forward, negative meaning the vehicle is moving backward
goToAbsolutePosition(n); – Continues the previous command for n marks relative to the overall starting position of the AEV
Scenario 1:
// Accelerate motor one from start to 15 percent in 2.5 seconds
celerate(1,0,15,2.5);
// Run motor one at constant 15 percent
motorSpeed(1,15);
//Runs motor for one second
goFor(1);
//Brakes motor one
brake(1);
// accelerates motor two from zero to 27 in four seconds
celerate(2,0,27,4);
// Run motor two at constant 27
motorSpeed(2,27)
//runs for 2.7
goFor(2.7);
//decelerates motor two from 27 percent to fifteen percent in one second
celerate(2,27,15,1);
//brakes motor two
brake(2);
//reverses motor two
reverse(2);
//accelerates all motors from start to 31 percent
celerate(4,0,31,2);
//motor speed for all motors to 35 percent
motorSpeed(4,35);
//goes for 1 sec
goFor(1);
//brakes motor 2
brake(2);
//runs motor one at 35 percent
motorSpeed(1,35);
//runs for 3 seconds
goFor(3);
//breaks all motors
brake(4);
//goes for one second
goFor(1);
//reverse motor one
reverse(1);
//accelerates motor one from start to 19 in two seconds
celerate(1,0,19,2);
//sets motor one speed one to 19
motorSpeed(1,19);
// sets motor two speed to 35
motorSpeed(2,35);
//goes for 2 seconds
goFor(2);
//both motor speed set to 19 percent
motorSpeed(4,19);
//runs for two seconds
goFor(2);
//decelerates both motors from 19 to 0
celerate(4,19,0,3);
//breaks all motors
brake(4);