The following is a list of functions being used in Arduino, the language utilized in the Alternative Energy Vehicle (AEV) project, alongside their syntax, and a given example for proper use and reference.
celerate(m, p1, p2, t); | m – numbered motor to be affected (1 = motor 1, 2 = motor 2, 3 = motor 3 [optional], 4 = all motors).
p1 – initial percent power usage (0-100). p2 – final percent power usage (0-100). t – time allotted for motor to reach p2 from p1 (in seconds) Example – celerate(2, 0, 30, 3); [Set motor to from 0% to 30% power usage in 3 seconds].
|
motorSpeed(m,P); | m – numbered motor to be affected (1 = motor 1, 2 = motor 2, 3 = motor 3 [optional], 4 = all motors).
P – percent power usage to set motor(s) to (0-100). Example – motorSpeed(4,27); [Set all motors to 27% power].
|
goFor(t); | t – time to allow a function to continue (in seconds);
Example – goFor(2.7); [continue executing the previous command for 2.7 seconds].
|
reverse(m); | m – motor to invert direction (1 = motor 1, 2 = motor 2, 3 = motor 3 [optional], 4 = all motors).
Example – reverse(1); [invert the direction of motor 1].
|
brake(m); | m – motor to halt function (1 = motor 1, 2 = motor 2, 3 = motor 3 [optional], 4 = all motors).
Example – brake(3); [ brake motor 3 ].
|
goToRelativePosition(n); | n – number of marks that the vehicle shall travel (directions can be changed depending on polarity)
Example – goToRelativePosition(-40); [AEV reaches -40 marks from its relative position]. |
goToAbsolutePosition(n); | n – distance from the vehicle’s initial position that it shall travel to.
Example – goToAbsolutePosition(100); [AEV travels to the location 100 marks from its starting point]. |