The four possible data wire errors are:
Each data wire carries a specific type of data between programming blocks. For example, if a data wire is dragged from a logic output plug on a block’s data hub, it will be carrying logic data. This data wire can only connect to a logic input plug on another block’s data hub.
For the same reason, number output plugs must be connected to number input plugs and text output plugs must be connected to text input plugs.
A type mismatch error occurs if you connect a data wire between plugs that handle different types of data, for example, connecting a logic output plug to a text input plug.
Avoid this error be paying particular attention to the data types of the plugs you are attaching data wires to.
Example:
Suppose you would like to display a number on your NXT’s screen.
In the first program shown below, a data wire is attempting to carry number data to a text input port. The data wire is “broken” and colored gray. This program is invalid and cannot be downloaded.
In the corrected program, a Text Format block (found in the Advanced block palette) has been added to first convert the number data to text. Then the text output from the Text Format block is carried to the Display block’s text input plug. This program is valid and can be downloaded.
Given any set of blocks and wires, if you are able to follow a wire path that visits the same block twice, you have a cycle. This will cause broken data wires and an invalid program.
The solution is to remove one or more wires from the cycle.
Example:
Suppose you want to create a program that keeps doubling the duration value
for a motor by reading the motor’s current duration, multiplying it by two,
and then feeding it back to the motor’s input plug.
The program below will not work because the data wires create a cycle. You can see that the wire path visits each of these blocks twice.
The program below solves the problem by using a number variable to send the doubled duration back in the loop.
A data wire without a data source cannot function; it has no data to carry and will be marked as broken.
For instance, on a data hub that has both input and output plugs for a certain property, the output plug will only work if another data wire is also connected to the input plug providing the output plug with a data source.
Example:
Suppose you want to pass data through another block’s data hub.
In the program below, the broken data wire (in gray) has no data to carry because nothing is “passed through” from the input plug. This program is invalid and cannot be downloaded.
In the corrected program below, an input data wire has been connected to the input plug. Number data from the Sound Sensor block can now be passed through the Math block to the Text Convert block.
More than one data wire connected to the same input plug will cause broken data wires and an invalid program.
The solution to this problem is to delete or move broken data wires so that each input plug is connected to only one output plug.
The illustrations below show an invalid program with broken data wires and then a corrected program.
To delete a data wire that stretches from left to right between two data plugs, click on the right plug.