Variables allow you to create dynamic sequences that execute differently depending on the value provided for the variable. This allows one sequence to be used more generally (in multiple ways), rather than for one specific purpose. To see how variables are used, let’s go through a practical example.
We’ll start with a static sequence (a sequence without any variables). Static sequences are executed the same way every time and can only be used for one specific purpose. For example, the sequence below can only be used to mount the watering nozzle tool because the LOCATION inputs in the Move commands are set to one location: the watering nozzle.
If you wanted to mount the seeder tool, you would need to make a second sequence with all of the LOCATION inputs set to the seeder tool. However, creating a bunch of copies of basically the same sequence would be tedious and cumbersome. Let’s see how variables can help.
To add a variable, click thebutton in the VARIABLES section of the sequence editor, followed by the option.
Name the variable “Tool” and then select the
Watering nozzle for the location variable’s value.
Now that the location variable has been added to the sequence, you can use it as the LOCATION input in all of the Move commands. Simply open up the LOCATION dropdowns and select
Tool - Watering nozzle (x, y, z).
Notice that if you change the variable’s value to a different tool, all of the Move commands that use the variable will update to the new value.
At this point the sequence can be quickly changed to mount any of the tools (assuming they all need to be mounted using the same general method). However, because the location variable can only be set to one specific value for the sequence to be saved, it is still considered static, and we would still be stuck making copies of the sequence - one for each the tools. Let’s see how externally defined variables can help.
To make the example sequence dynamic and truly reusable for all of the tools, the variable must be externally defined. This will allow the variable value to be provided from another sequence, a regimen, or an event, which will dictate how the sequence is run each time.
To do this, change the variable value to
Externally defined. This selection will then get reflected in all of the Move commands as they update to Tool - Externally defined .
Optionally provide a default value
If you want, you can provide a DEFAULT VALUE for the variable, which will be used anytime a value from somewhere else isn’t explicitly provided.
Now the sequence is built in a generic way that will allow it to mount any tool, depending on what value is provided for the location variable! In the next page we’ll look at all the ways in which you can provide this value.