<< Click to Display Table of Contents >> Using Tags in Structured Text |
|
Of course for our purposes we need to use Tags in our scripts written in Structured Text language. How to do that? You can include Tags in your project’s scripts by using keyword Tags. Then type dot (.) and name of your Tag. For possibility to compile this code the name of the tag should contain only English letters without white spaces and any signs.
Example:
int var = 10;
Tags.Tag1 = var;
In this example value of the variable var will be assigned to tag's value with name Tag1.
Other Example:
float f = Tags.Float1;
In this example value of the tag with name Float1 will be assigned to variable f.
Array Example:
byte bytes[10] = Tags.Array;
In this example value of the array tag with name Array will be assigned to the bytes array.
And you can use every element of the array for other operations. Like this:
for (int i=0;i<10;i++){
print(bytes[i]);
}