Connect a variable to a function block
After you add a variable, you can connect it to a function block (FB) and use it to control a parameter. For more information about how to add a variable, see Add variables.
- In the Local variables pane, drag a variable to the source editor.
- In Var type, you need to decide whether the variable is used as an input or output. Click Input and click OK.
- The variable has been added to the source editor. Drag the variable until it is close to the Execute parameter in the FB.
- The variable is connected to the Execute parameter.
- You can add another variable and connect it to another parameter. Notice that you need to give a variable an initial value if the parameter this variable controls requires it. In this guide we connect the Position variable to the Position parameter. Since the Position parameter needs a value, we assign an initial value to the variable for the parameter to use.