Commands with multiple input parameters Pro Preview

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.

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #1535
  • 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

Image for Python with LEGO Mindstorms EV3 - Level 1
  • 74
  • 28:18
  • 114
Image for Lesson 2 - Robotic arm
  • 10
  • 5
  • 9
  • 3d_rotation 1