How to turn the motor 90 degrees without calculating speed and time ratio Pro Preview

We can calculate how much time the motor should turn at a given velocity for it to reach the required position, but this will not be necessary. In such cases, it would be much easier to use the motor.run_for_degrees()

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #2601
  • 13 Mar 2026

This command has three required input parameters:

  1. Motor port - you can write the number of the motor, or use the "port" keyword to assign it by its letter;

  2. How many degrees the motor should turn at;

  3. The speed with witch to execute the command;

    • Small motor: -660 to 660

    • Medium motor: -1110 to 1110

    • Large motor: -1050 to 1050

Here's an example of how the robot can be programmed to move a single motor to 90 degrees with a speed of 360:

from hub import port
import motor
import runloop

async def main():
    #Move for 90 degrees at 360 speed
    motor.run_for_degrees(port.A, 90, 360)

runloop.run(main())

If we wish to turn the motor in reverse, we can use one of two options:

  1. Set it to a negative speed:
    motor.run_for_degrees(port.A, 90, -360)
  2. Set it to a negative angle:
    motor.run_for_degrees(port.A, -90, 360)

If you set a negative angle and negative speed, the motor will reverse its direction twice and it will move forward:

motor.run_for_degrees(port.A, -90, -360)