Box - Inputs/outputs ¶
Input of a box ¶
To activate those which are available from the outside of the box, you have to connect them to either the main input of the diagram, or the output of a box.
The others are automatically activated when a special event is raised.
The picture displayed on an input depends on its nature :
|On the box||
|onStart||When this input is stimulated, the box is started .|
When this input is stimulated, the box is stopped .
This input is only visible outside the box (not within the diagram of the box) as it automatically stops everything within the diagram.
This input has no specific effect on the box, it does not start nor stop it. When it is stimulated:
This special type of input is only visible within the diagram. So you cannot stimulate it from the outside of the box.
It is stimulated every time the value of the data stored in ALMemory corresponding to this input is updated and an event is raised to tell that it has been updated. Note that these inputs are only active when the diagram is loaded .
To have an example of use of this type of input, see the tutorial Creating a box to retrieve right bumper value using ALMemory .
This type of input is only visible within the diagram and when the box is a Timeline.
So you cannot stimulate it from the outside of the box. It is only stimulated when the box diagram has been loaded .
Output of a box ¶
They are several natures of outputs.
To stimulate it from the script of the box, you need to call its corresponding method. For more information about this corresponding method, see the section: Built-in functions in the script of a box .
The picture displayed on an output depends on its nature :
|On the box||
This output has no specific effect on the box, it does not start nor stop it.
When it is stimulated, the signal received on the output is transmitted to the parent diagram .
Type of I/O (input/output) ¶
The communication between boxes is event based , so a simple event signal can be sent from one box to another. But the signal can also carry information (such as a string, a number, an array...).
Then an important thing you need to know about I/O is that the color of an I/O depends on the type of the data it carries.
Here is a table gathering all types of I/O with their corresponding color:
Depending on their type, it is not always possible to connect two I/O : the information the output sends has to be understandable by the input.
You can connect any type of I/O to a Bang input. The data sent will then be lost and will only be understood as a simple event .
Input, and output edition widgets ¶
When you create or edit an box input , the following widget is displayed:
You can here set:
the name of the input.
the brief description of what is done when this input is stimulated in the field Tooltip .
This description will appear in a tooltip displayed by passing above the input in the flow diagram.
the type of data expected by this input in the field Type : Dynamic, “Bang”, Number or String. For further details about these types, see the section: Type of I/O (input/output) .
You can also choose the nature of the input: onEvent, onStart, onStop or ALMemory Input. For more information about these natures, see the section: Input of a box .
If the input is an ALMemory input, you will be able to choose which value from ALMemory the input will be connected to.
You need to be connected to a robot if you want to browse the list of available values.
When you create or edit an box output , you get a very similar widget:
But you have no field ALMemory Value name and the available nature of outputs are different: onStopped or punctual. For more information about these natures, see the section: Output of a box .