So far, you have used commands requiring only one input parameter, but many commands in programming require a lot more than one type of information. Such an example is the "run_time()" command.
- 15 Feb 2020
This command moves the motor if it is given the speed and time of the movement and the type of brake. In commands such as these, the input parameters are entered one after another and separated with commas.
Order of the parameters.
The order in which the parameters are entered is important. If we wish to move the robot at 45 degrees per second for 2 seconds, the command would look as follows:
Motor(Port.D).run_time(45, 2000, Stop.HOLD)
If we enter the time we want the robot to turn for in the first field, however, this command will try to turn the motor for 0,0045 seconds (45 milliseconds):
Motor(Port.D).run_time(2000, 45, Stop.HOLD)
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons