# How do you max out a motor using voltageUnits?

Hey everyone,

I’m attempting to code (with help) a PID program, and I’ve been told to use voltageUnits. With a drivers code that is similar, what value would I put in to get a motor to go at its max speed?

For example:

``LeftFrontDrive.spin(forward, 100.0, voltageUnits::volt);``

Thanks,
Omnom

1 Like

The maximum voltage that you can set a motor to is 12 I think. So if you put something greater than 12, the program will automatically cap it at 12 volts.

3 Likes

Oh okay, well that’s odd it seems really slow in comparison to rotations. Is there one that is better than the other that would still work in that code format?

Other than voltage, there’s velocity units from what I know. Voltage units are slightly better because maxing out the voltage allows you to push the motor further than it can with velocity units. For example, a motor using velocity units might max out at 100 rpm since the program is directly controlling that. On the other hand, a motor using voltage units might max out at 110 rpm since voltage is being directly controlled, and 12 volts might be more than enough to reach 100rpm. The issue that comes with this is that running voltage units may be riskier as it might burn out the motor and possibly ports.

If i remember correctly velocity units should be

`` LeftFrontDrive.spin(directionType::rev, 75, velocityUnits::pct); ``

FYI rev can also be fwd and velocity units should max out at 100 I think

2 Likes

I thought VEXCode help had those details like the min and max voltage values, but apparently it no longer has: V5 Motor API

So I go to PROS V5 API reference to get those: Motors C++ API — PROS for V5 3.5.2 documentation

@tfriez, is there any chance that lost useful information could be added back to VEX Online help?

4 Likes

Yep, unintended detail lost during the migration to the new doc system. We’ll get that data added back in.

Thanks!

3 Likes

Hey @weilin we just updated the API Reference. We added the voltage range info to the spin calls using voltage.

2 Likes

Make sure to hard refresh to clear your browser cache!

1 Like