To move a motor, we set the speed at which we want it to move, and the amount of time we want it to move. There is a command that allows you to set both these parameters at once.
Необходимо е да се абонирате за FLLCasts.com, за да достъпите това видео
- #2584
- 06 Feb 2026
The command is:
await motor.run_for_time(port.A, 1000, 2000)
This command has 3 input parameters,:
- Motor - the first parameter in the "run_for_time()", "port.A" in the example above, points to the motor we wish to move.
- Speed - the second parameter in the "run_for_time()", 1000 in the example above, sets the speed of the motor to 1000 degrees per second;
- Duration - the final parameter in the "run_for_time()" command, 2000 in the example above, tells the motor to move for 2000 milliseconds (2 seconds);
The "await" word before the command tells the program to wait until this command has fully executed. Without this word, the program will continue to execute other commands, even those that would interfere with the completion of this one.