Data Wires, Hubs, and My Blocks
Ø Data wires are used to carry information between blocks.
Ø Three types of data can be carried by data wires
|
Type of Data |
Color of the WIre |
Range of Values |
|
Numeric |
Yellow |
Integers, positive and negative |
|
Logical |
Green |
True or False |
|
Text |
Red |
String of alphanumeric characterics |
Ø Data wires can be expanded or contracted by clicking on the bottom left-hand corner of the icon

Ø Data wires functions for the light, move, ultra sonic touch and sound blocks. Data hub functions listed top to bottom
| Blocks | |||||
| Data Hub | Light | Move | Ultrasonic | Touch | Sound |
| 1 | Intensity | Left Motor | Port | Yes/No | Sound Level |
| 2 | Right Motor | Trigger Point | |||
| 3 | Other Motor | Greater/Less | |||
| 4 | Direction | Yes/No | |||
| 5 | Steering | Distance | |||
| 6 | Power | ||||
| 7 | Duration | ||||
| 8 | Next Action | ||||
|
A yellow wire carries the light intensity reading (numeric
data) from the sensor block to the math block (covered below). The second wire (green) carries a logical signal from the math block to the move block. The signal control the direciton in which the motors run. |
![]() |
Ø Example Program 2 - Annotated

Ø Variables - a variable block and its configuration pane are shown below

Ø Arithmetic Operators (see text)
· As might be expected from their name, these operators perform arithmetic operations on numeric values, including values stored in variable blocks.
· Four operations are provided - sometimes referred to as the "four rules".
· These operations are: add, subtract, multiply, and divide. All of these are performed by the Math block.
· When dividing, the operation loses the digits after the decimal point. This can be avoided by writing additional routines
Ø Logical Operators (see text)
· Operations on logical variables comprise NOT, AND, OR.
· These operations are performed by a Logic Block.
Ø Flag Variables (see text)
· Often we assign a logical variable to act as a flag.
· The variable has the default value False, but is set to True when a specified event occurs.
· For example, a flag variable named intensity can be set to True when the light sensor detects a light intensity greater that a specified value.

Ports: top to bottom
|
Port |
Property |
|
1 |
Input A |
|
2 |
Input B |
|
3 |
Result |
The math block performs simple arithmetic operations such as add, subtract, multiply and divide. The input numbers can be typed or supplied dynamically by data wires.
The Math block allows the programmer to process data the block receives. In the previous example ( assumes black line on white background) the robot took a light reading on the white background and sent this reading via a data wire to the Math’s block. The Math’s block then subtracted 5 from this reading, the program then uses this lower ( darker) reading to line follow, it assumes that the processed number represents black. This rules out the need for the programmer to take and input light readings and removes “human error” from taking readings.
