Adding Parameters to My Blocks Pro Preview

To access the full video please subscribe to FLLCasts.com

Subscribe

  • #1193
  • 10 Apr 2019

Parameters

Often we need to repeat a sequence of blocks with slight change. For an example the Proportional Line Following algorighm. We want to use it in different setups with different power set to the motors. Actually, if we want to use the same My block on different robots we will most probably need to change all of the ports within the block, which can lead to mistakes, especially if there are many places to change the ports. 

In both cases a good way to resolve the issue is to use parameters within the My block. There are two types of parameters - input and output. Input parameters are used when you need to pass a value to the my block. For instance the speed of the motors can be an input parameter. That value then can be passed to the motor blocks as power.

Adding parameters to a My block

First select the plus sign to add a new parameter:

 

Next we have to setup the parameter. Select the second tab Parameter Setup:

 

Here we can set the name and type of the parameter. Next we have to set the data type i.e. what kind of value the parameter will contain (For more on data types within the EV3 Software take a look here). Finally, we set the default value i.e. what will be the value of the parameter if we do not enter anything. 

After we have finished with the parameter setup, we proceed with choosing an icon for the parameter. This is done through the third tab - Parameter Icons:

 

When we choose an appropriate icon, select finish and the parameter will be added.

 

Example

Let us add a parameter for the font size to our dummy my block. The font size of the display block can be either 0, 1 or 2. So the parameter is input, the data type is number and the default value is 2:

Linking parameters within the My block

Once you have created parameters they will appear within the My block. Each parameter will look like a floating block with just the icon of the parameter -  

Use the wire from that floating block and connect it where necessary. In our example we should connect it to all of the display blocks within the My block:

Now if we go back to the program we have originally created, we will see that there is a new field appeared on the My block. There we can input the value we want to set for the font of the Dummy block.

Courses and lessons with this Tutorial

This Tutorial is used in the following courses and lessons

Image for Instructors Remote Training
  • 136
  • 280:11
  • 156
Image for My Blocks
  • 8
  • 1
  • 10
  • 3d_rotation 1
Image for Robotics with LEGO - Level 3.5 - Measuring tools
  • 58
  • 0:00
  • 185
Image for Robotics with LEGO - Level 3.5 - Measuring tools
  • 58
  • 0:00
  • 185
Image for Robotics with LEGO - Level 4.0 - Kinesthetic and Memory Game (in development)
  • 59
  • 2:58
  • 200
Image for Robotics with LEGO - Level 4.5 Game Time
  • 35
  • 13:40
  • 221
Image for Level 3.7 - Smart Robots
  • 15
  • 1:03
  • 111
Image for Занятие 1 - Ball Hunter, броене на топки
  • 8
  • 13
  • 21
  • 3d_rotation 1