# Voltage over spin distance/time?

How do the voltage commands relate to the spin commands? What’s the difference? How do the units correlate? Would it be better to use volts rather than spin distance/time?
Most importantly, if I used volts, would it prevent the issue during autonomous in which the robot stops if it can’t complete a line of distance code?

Volts are just a power unit, like percent. So for example, you could write `motor.spin(fwd, 100, pct);`
or `motor.spin(fwd, 12, volt);`
and they are (mostly) the same thing. The difference is, you’re literally specifying the voltage that the brain will send through the cable to the motor.

Volts directly specify how much energy to power the motors with, and all the other commands use vexcode’s built in speed algorithm to calculate how many volts to use to go a certain speed. Using volts gives you more direct control over the motors, because there is no “middleman” speed or distance algorithm between your code and the motor.

volts don’t replace motor distance or speed commands, they are just a different way of controlling the motors. I think your problem can be solved by adding a timeout to the movements.

2 Likes