# — Move At Velocity (MAV)

The recommended function to use in order to have more control in movement is the “move at velocity” – mav() function. How is this different than the ‘motor’ function? The motor() function tells which port gets how much voltage. The mav() function has a way of checking the actual velocity of the motor and adjusts the voltage in order to maintain the velocity prescribed in the program.

The function takes two parameters just like ‘motor’:

mav(a,b)

a = The motor port – just like in the motor function.

b = The velocity* – how many ticks (there are 1,100 ticks for one rotation or 360 degrees) per second that the motor rotates (positive or negative).

So let’s write a program that uses mav() instead of motor().

int main()

{

mav(0,500);

mav(3,500);

msleep(1000);

}

Download and run this program.

Notice that this is speed and not power as in the motor() function.

If you have two identical robots, program one with mav() functions and the other with motor() functions to compare power levels and speeds.  Otherwise, just mark the beginning and end of robot motion with each function and compare.  Try running the programs up and down a sloping surface to see difference.

Experiment, also, with changing the values of the velocity between -1000 and 1000. If one motor is slower than the other, will it still turn like in the lesson of turning?

* – Velocity includes direction and speed does not. Velocity can be negative while speed is the absolute value of velocity. Advertisements