Skip to content

Create a subprogram with input parameters

What you will learn

  • Place a Subprogram block inside a program
  • Loop For usage
  • Assign inputs to a program
  • Run a subprogram with changed input values
  1. Create a new program and name it.

  2. Add a Loop For block from the Control Structures.

  3. Add a Move Cartesian block from "Robot" Function Blocks inside the loop.

  4. Add two waypoints to the Move Cartesian block.

  5. Select Set parameters at the top.

  6. In the "input parameters" you will be able to create, modify and delete input parameters. Create a new one and select type as integer, 'No of Loops' as title and write 3 as default value.

  7. Now we will connect the number of interations with this input parameter. For this purpose, select Set Parameters of the loop block.

  8. Select the link button of Turns parameter and select 'No of Loops' from parent program input by clicking the tick tick-button. This will connect the value introduced in the program to the for loop.

  9. Save the program. Now we can use this program inside another programs.

  1. Now create another new program.

  2. Look for the created program in the subprograms tab and add it to the program sequence.

  3. Select Set Parameters of the program.

  4. Change the 'No of Loops' to 2 instead of leaving the default value.

  5. Now the program can be started. The program will execute the given number of iterations.