Top (hightest) motor speed setting?


The documentation for setMotorSpeed says that the motor speed is a percentage and values range from -100 (full speed reverse) to 0 (stopped) to +100 (full speed forward). A few of the sample code files that come with the RobotC programming tool show the use of motor speeds from -127 to 0 to +127. For example: [INDENT]File > Open Sample Program
Select the VexIQ\Wireless Controller (Remote Control) folder
Select the Advanced 2-Joystick Drive with Buttons.c file[/INDENT]

My questions:

  • What is the actual legitimate range of values for motor speed?
  • What happens if I provide an out of range value to setMotorSpeed()? [/LIST] Thanks, David

  • #2

    -100 to 100 is the range in IQ.
    The reason for these 127 figures is legacy from the VEX EDR system and probably copied across to the help file in error. Motor control uses 8-bits or 1 byte of data so 255 possible values. In VEX EDR, the motor can be set from -127 to +127.

    In IQ it is made slightly easier by being represented by a percentage value which means only 201 possible values and so a slightly lower resolution of control. In practice, this makes no difference from a user perspective.


    CalvC01: Thanks for the reply.

    What about the second part of my question… what happens if I provide an out of range value to setMotorSpeed()?


    Absolutely nothing, it’ll just max at 100. Interesting things will start happening if you send a value of more than 32,767 to a motor. It’ll go backwards.