Data wires carry information between programming blocks. Many blocks require that a data wire be attached if the blocks are to function at all. For example, the output from a Random block can only be sent out via a data wire.
Opening data hubs and creating data wires
You create a data wire by “drawing it out” of a block’s data hub. Nearly all of the programming blocks have data hubs and can support data wires.
Open a block’s data hub by clicking the tab at the lower left edge of the block after it has been placed on the work area.
Note: Sometimes data hubs will not open completely, leaving some plugs hidden. Reveal all of a data hub’s plugs by clicking again on the tab area (as shown in the left image above). You can also close a data hub (or hide any unused plugs not connected to data wires) by clicking the tab area. This will help clean up your work area.
Drawing out a data wire
The cursor will change shape when it hovers over or is near a data plug. If you then press the mouse button and drag to the right, a data wire will “unroll” that can be connected to a plug on another block’s data hub.
Deleting a data wire
To delete a data wire that stretches from left to right between two data plugs, click on the right plug.
Input and output
Data wires carrying information to a block (i.e., carrying input) are connected to the plugs on the left side of its data hub. Data wires carrying information away from a block to another block (i.e., carrying output) are connected to the plugs on the right side.
[A] Input plug
[B] Output plug
[C] Number data wire (yellow)
[D] Logic data wire (green)
[E] Text data wire (orange)
[F] Broken data wire (gray)
Data wires carry specific types of data
Each data wire carries a specific type of data between blocks. For example, if a data wire is dragged from a logic plug on a block’s data hub, it can only be connected to a logic plug on another block’s data hub.
Data wire colors
Data wires are identified with specific colors:
- wires carrying number data are colored yellow
- wires carrying logic (true/false) data are colored green
- wires carrying text data are colored orange.
Broken data wires
If you try to connect a data wire to a plug of the wrong data type, the data wire will be “broken” and colored gray. You will not be able to download your program if it contains broken data wires.
If you click on a broken wire you can read why it is broken in the small help window at the lower right corner of the work area.
Data must be within the possible range of the plug
If an input data wire transmits a value outside the possible range of the plug it is connected to, the block will either ignore the value or change it to a value within its range. For plugs that allow just a few input values (example: just 0, 1, or 2), the plug will ignore the input if a value arrives outside its range.
For plugs that accept larger input ranges (example: 0 – 100), the plug will force any input outside its range to fit. For example, if a Move block’s Power plug receives an input value of 150, the block will change the input value to 100 (i.e., a number within the Power plug’s range).
Passing data from the input plug to the output plug
If an input plug has a corresponding output plug, the input data will pass through from the input plug to the output plug without being changed. In this case, you can only use the output plug if the input plug is connected to an input data wire; connecting an output data wire to such an output plug without a connected input data wire will cause the output data wire to be “broken” and colored gray.
Data Hub chart
The Help file for each programming block contains a chart that shows the different characteristics of the plugs on the block’s data hub. For example, the chart for the Keep Alive block looks like this:
Plug | Data Type | Possible Range | What the Values Mean | This Plug is Ignored When... | |
Time until sleep | Number | 0 - 4294967296 | Time in milliseconds until the NXT goes to sleep |