Data Hub and Data Wire
1. Data Hub and 2. Data Wires
Before we begin with the advanced blocks, we should learn a bit about something called the Data Hubs and Data Wires. You have seen it before but until now we have never used it.
Data hubs and wires look like the picture to the left and are found in the dropdown menus of blocks. These can be dangerous to your program if you don't know what you are doing. Now we will begin to understand what they are used for and how we can use them without breaking our programs.
Data hubs and wires are used to pass around information in between blocks. The data or information can be an integer, a boolean, or text. An integer is any whole number, no decimal places. A boolean is a true or false, like a yes or no question. Text is a sentence or any arrangement of letters. The wire colours correspond to the type of information it is passing.
Yellow is integer data, green is boolean data, and red is text data.
Data hubs and wires look like the picture to the left and are found in the dropdown menus of blocks. These can be dangerous to your program if you don't know what you are doing. Now we will begin to understand what they are used for and how we can use them without breaking our programs.
Data hubs and wires are used to pass around information in between blocks. The data or information can be an integer, a boolean, or text. An integer is any whole number, no decimal places. A boolean is a true or false, like a yes or no question. Text is a sentence or any arrangement of letters. The wire colours correspond to the type of information it is passing.
Yellow is integer data, green is boolean data, and red is text data.
Sometimes when creating a wire you will get a Broken Data Wire. This is grey and dotted. It means you are connecting two data hubs of different data type. For example, you might accidentally be trying to connect a Integer data hub to a Boolean data hub.
To make a data wire, click on the symbol of the data hub you wish to begin the wire from and then click on the data hub you wish to connect it to. To get rid of a wire before it is connected, click the ESC key. To get rid of a wire already connected at both ends, click and drag one of the blocks it is connected to away and then you can put it back after the wire disappears. Try this a couple times on your own. Most of the wires you connect should end up being dotted because we haven't yet figured out which hubs are of what data type. Make sure you are connecting wires from the right hub of one block to the left side of another.
To tell what data type a data hub is you can click on the symbol and drag your mouse out. This will create a data wire from the hub but do not click it anywhere. Look at the colour and match that to the data type as they are labelled above.
Every data hub corresponds to some sort of value within the block's settings. To figure out which setting the hub is connected to, hover your mouse over the data hub. A word will pop up explaining what the value going into or coming out of it represents. For example, the first hub in the motor block will say port. This means it can change the port number of the block if it is given a number or it will send the port number of the block on an outgoing data wire.
To tell what data type a data hub is you can click on the symbol and drag your mouse out. This will create a data wire from the hub but do not click it anywhere. Look at the colour and match that to the data type as they are labelled above.
Every data hub corresponds to some sort of value within the block's settings. To figure out which setting the hub is connected to, hover your mouse over the data hub. A word will pop up explaining what the value going into or coming out of it represents. For example, the first hub in the motor block will say port. This means it can change the port number of the block if it is given a number or it will send the port number of the block on an outgoing data wire.
Back to Advanced Blocks