Operators#

Add#

The Add block is used to add any two values together and reports the sum.

A green, rounded block from a visual programming interface, featuring two input fields with the number '0' in each, separated by a plus sign ('+') in the center. This block represents an addition operation where two values are summed.

The Add block can accept decimals, integers, or numeric blocks.

The Add block fits in blocks that accept circular spaces, and can accept other circular blocks in it as well.

In this example, the Drivetrain will move forward for 400 mm.

A visual programming block sequence starting with a yellow 'when started' block. Attached to it is a blue 'drive forward for' block. Inside the block, the distance is specified by a green, rounded addition block, which contains two input fields with the values '100' and '300', separated by a plus sign ('+'). The unit of measurement is set to 'mm', indicating the robot will drive forward for the sum of these two distances, which is 400 mm.

Subtract#

The Subtract block is used to subtract one value from another and reports the difference.

A green, rounded block from a visual programming interface, featuring two input fields with the number '0' in each, separated by a minus sign ('-') in the center. This block represents a subtraction operation where one value is subtracted from another.

The Subtract block can accept decimals, integers, or numeric blocks.

The Subtract block fits in blocks that accept circular spaces, and can accept other circular blocks in it as well.

In this example, the Drivetrain will move forward for 400 mm.

A visual programming block sequence starting with a yellow 'when started' block. Attached to it is a blue 'drive forward for' block. Inside the block, the distance is specified by a green, rounded subtraction block, which contains two input fields with the values '500' and '100', separated by a minus sign ('-'). The unit of measurement is set to 'mm', indicating the robot will drive forward for the result of this subtraction, which is 400 mm.

Multiply#

The Multiply block is used to multiply any two values together and reports the product.

A green, rounded block from a visual programming interface, featuring two input fields with the number '0' in each, separated by an asterisk ('*') in the center. This block represents a multiplication operation where two values are multiplied together.

The Multiply block can accept decimals, integers, or numeric blocks.

The Multiply block fits in blocks that accept circular spaces, and can accept other circular blocks in it as well.

In this example, the Drivetrain will move forward for 600 mm.

A visual programming block sequence starting with a yellow 'when started' block. Attached to it is a blue 'drive forward for' block. Inside the block, the distance is specified by a green, rounded multiplication block, which contains two input fields with the values '200' and '3', separated by an asterisk ('*'). The unit of measurement is set to 'mm', indicating the robot will drive forward for the result of this multiplication, which is 600 mm.

Divide#

The Divide block is used to divide the first value by the second value and reports the dividend.

A green, rounded block from a visual programming interface, featuring two input fields with the number '0' in each, separated by a division symbol ('/') in the center. This block represents a division operation where one value is divided by another.

The Divide block can accept decimals, integers, or numeric blocks.

The Divide block fits in blocks that accept circular spaces, and can accept other circular blocks in it as well.

In this example, the Drivetrain will move forward for 400 mm.

A visual programming block sequence starting with a yellow 'when started' block. Attached to it is a blue 'drive forward for' block. Inside the block, the distance is specified by a green, rounded division block, which contains two input fields with the values '1200' and '3', separated by a division symbol ('/'). The unit of measurement is set to 'mm', indicating the robot will drive forward for the result of this division, which is 400 mm.

Random#

The Random block is used to report a random value between the lowest and highest values in the block.

A green, rounded block from a visual programming interface labeled 'pick random.' The block contains two input fields with the values '1' and '10,' separated by the word 'to.' This block represents a function that picks a random number between the specified range of 1 to 10.

The Random block can accept decimals, integers, or numeric blocks.

In this example, the Drivetrain will move forward for a random distance between 700 and 1000 mm.

A visual programming block sequence starting with a yellow 'when started' block. Attached to it is a blue 'drive forward for' block. Inside the block, the distance is specified by a green, rounded block labeled 'pick random,' which contains two input fields with the values '700' and '1000,' separated by the word 'to.' The unit of measurement is set to 'mm,' indicating the robot will drive forward for a random distance between 700 mm and 1000 mm.

Greater than#

The Greater than block is used to report if the first value is larger (greater) than the second value.

A green, diamond-shaped block from a visual programming interface featuring two input fields with the values '0' and '50,' separated by a greater-than symbol ('>'). This block represents a comparison operation where the first value is checked to see if it is greater than the second value.

The Greater than block can accept decimals, integers, or numeric blocks.

The Greater than block reports true when the first value is larger than the second value and false when the first value is smaller than or equal to the second value.

The Greater than Boolean block reports a true or false value and fits in blocks with hexagonal (six-sided) spaces.

In this example, the Drivetrain will move in reverse for 400 mm, because 0 > 50 returns False.

A visual programming block sequence that begins with a yellow 'when started' block. Below it is a yellow 'if-then' block with a condition. The condition is a green, diamond-shaped comparison block that checks if '0 > 50.' If the condition is met, the first action is to 'drive forward for 400 mm' using a blue block. The second action is to 'drive reverse for 400 mm,' also using a blue block. This sequence will cause the robot to move forward and then reverse if the condition is true.

Less than#

The Less than block is used to report if the first value is less (smaller) than the second value.

A green, diamond-shaped block from a visual programming interface featuring two input fields with the values '0' and '50,' separated by a less-than symbol ('<'). This block represents a comparison operation where the first value, 0, is checked to see if it is less than the second value, 50.

The Less than block can accept decimals, integers, or numeric blocks.

The Less than block reports true when the first value is smaller than the second value and reports false when the first value is greater than or equal to the second value.

The Less than Boolean block reports a true or false value and fits in blocks with hexagonal (six-sided) spaces.

In this example, the Drivetrain will move forward for 400 mm, because 0 < 50 returns True.

A visual programming block sequence that begins with a yellow 'when started' block. Below it is a yellow 'if-then' block with a condition. The condition is a green, diamond-shaped comparison block that checks if '0 < 50.' If the condition is met, the first action is to 'drive forward for 400 mm' using a blue block. The second action is to 'drive reverse for 400 mm,' also using a blue block. This sequence will cause the robot to move forward and then reverse if the condition is true.

Equal to#

The Equal to block is used to report if the first value is the same as, or equal to, the second value.

A green, diamond-shaped block from a visual programming interface featuring two input fields with the values '0' and '50,' separated by an equal sign ('='). This block represents a comparison operation where the first value, 0, is checked to see if it is equal to the second value, 50.

The Equal to block can accept decimals, integers, or numeric blocks.

The Equal to block reports true when the two values are exactly the same and reports false when the two values are not the same.

The Equal to Boolean block reports a true or false value and fits in blocks with hexagonal (six-sided) spaces.

In this example, the Drivetrain will move in reverse for 400 mm, because 0 = 50 returns False.

A visual programming block sequence that begins with a yellow 'when started' block. Below it is a yellow 'if-then' block with a condition. The condition is a green, diamond-shaped comparison block that checks if '0 = 50.' If the condition is met, the first action is to 'drive forward for 400 mm' using a blue block. The second action is to 'drive reverse for 400 mm,' also using a blue block. This sequence will cause the robot to move forward and then reverse if the condition is true.

And#

The And block is used to report if two Boolean conditions are both true.

A green, diamond-shaped block from a visual programming interface labeled 'and.' The block has two open hexagonal slots on either side where additional blocks can be inserted. This block is used to represent a logical 'and' operation, combining two conditions.

The And block reports true when both conditions are true and reports false when one, or both, of the conditions are false.

The And Boolean block reports a true or false value and fits in blocks with hexagonal (six-sided) spaces.

In this example, if the Down Eye Sensor detects a red object and the drivetrain is moving at the same time, the Drivetrain will stop moving. Otherwise, the Drivetrain will keep moving forward.

A visual programming block sequence that begins with a yellow 'when started' block. Below it is a yellow 'if-then' block with a condition. The condition includes a green, diamond-shaped 'and' block that combines two conditions. The first condition is a blue block stating 'DownEye detects red?' and the second condition is another blue block stating 'drive is moving?' If both conditions are true, the sequence triggers the action 'stop driving' using a blue block. An additional action 'drive forward' is placed after the 'if-then' block, but it is not within the conditional logic.

Or#

The Or block is used to report if one of two Boolean conditions are true.

A green, diamond-shaped block from a visual programming interface labeled 'or.' The block has two open hexagonal slots on either side where additional blocks can be inserted. This block is used to represent a logical 'or' operation, combining two conditions.

The Or block reports true when one (or both) of the conditions are true and reports false when both of the conditions are false.

The Or Boolean block reports a true or false value and fits in blocks with hexagonal (six-sided) spaces.

In this example, if the Down Eye sensor detects a red or green object, the Drivetrain will stop. Otherwise, the Drivetrain will keep moving forward.

A visual programming block sequence that begins with a yellow 'when started' block. Below it is a yellow 'if-then' block with a condition. The condition includes a green, diamond-shaped 'or' block that combines two sub-conditions. The first sub-condition is a blue block stating 'DownEye detects red?' and the second sub-condition is another blue block stating 'DownEye detects green?' If either of these conditions is true, the sequence triggers the action 'stop driving' using a blue block. An additional action 'drive forward' is placed after the 'if-then' block, but it is not within the conditional logic.

Not#

The Not block is used to report the opposite (inverse) of the reported Boolean value.

A green, diamond-shaped block from a visual coding interface labeled 'not.' The block has one open hexagonal slot on the right side where an additional block can be inserted. This block is used to represent a logical 'not' operation, which inverts the condition that is placed inside it.

The Not block reports true when the Boolean block inside reports false and reports false when the Boolean block inside reports true.

The Not Boolean block reports a true or false value and fits in blocks with hexagonal (six-sided) spaces.

In this example, if the Left Bumper Sensor has not been pressed, the Drivetrain will move forward. If the Left Bumper Sensor has been pressed, the Drivetrain will stop.

A visual coding block sequence that begins with a yellow 'when started' block. Below it is a yellow 'if-then' block with a condition. The condition includes a green, diamond-shaped 'not' block that contains a blue block stating 'LeftBumper pressed?' If the LeftBumper is not pressed, the sequence triggers the action 'drive forward' using a blue block. The next action, 'stop driving,' follows outside of the conditional block.

Round#

The Round block is used to round the inputted value to the nearest integer.

A green, rounded block from a visual coding interface labeled 'round.' The block contains an input field on the right side with the number '0.' This block is used to round the value entered in the input field to the nearest integer.

The Round block can accept decimals, integers, or numeric blocks.

Decimals that are 0.5 or greater round up and decimals less than 0.5 round down.

The Round block fits in blocks that accept circular spaces, and can accept circular blocks in them as well.

In this example, the Drivetrain will move forward for the rounded number of 474 mm.

A visual coding block sequence starting with a yellow 'when started' block. Attached to it is a blue 'drive forward for' block. Inside the block, the distance is specified by a green, rounded 'round' block that contains the value '473.64.' The unit of measurement is set to 'mm,' indicating the robot will drive forward for the rounded value of 473.64 mm, which would be 474 mm.

Function#

The Function block is used to perform a selected math function.

A green, rounded block from a visual coding interface with a dropdown menu labeled 'abs' followed by the word 'of' and an input field containing the number '0.' This block is used to calculate the absolute value of the number entered in the input field.

The Function block can accept decimals, integers, or numeric blocks.

The available functions are:

  • abs - absolute value

  • floor - rounds down to the nearest integer

  • ceiling - rounds up to the nearest integer

  • sqrt - square root

  • sin - sine

  • cos - cosine

  • tan - tangent

  • asin - arcsine or the inverse of sine

  • acos - arccosine or the inverse of cosine

  • atan - arctan or the inverse of tangent

  • ln - the natural logarithm base e

  • log - logarithm base 10

  • e ^ - powers of e

  • 10 ^ - powers of 10

The Function block fits in blocks that accept circular spaces, and can accept circular blocks in them as well.

In this example, the Drivetrain will move forward for 760 mm.

A visual coding block sequence starting with a yellow 'when started' block. Attached to it is a blue 'drive forward for' block. Inside the block, the distance is specified by a green, rounded block with a dropdown menu set to 'abs' (absolute value), followed by 'of' and an input field containing the value '-760.' The unit of measurement is set to 'mm,' indicating the robot will drive forward for the absolute value of -760 mm, which is 760 mm.

Remainder#

The Remainder block is used to divide the first value by the second value and report the remainder.

A green, rounded block from a visual coding interface labeled 'remainder of.' The block contains two input fields with the number '0' in each, separated by a division symbol ('/'). This block is used to calculate the remainder when the first value is divided by the second value.

The Remainder block can accept decimals, integers, or numeric blocks.

Numbers that divide evenly will report a remainder of zero.

The Remainder block fits in blocks that accept circular spaces, and can accept circular blocks in them as well.

In this example, the Drivetrain will wait 2 seconds before moving forward for 200 mm.

A visual coding block sequence starting with a yellow 'when started' block. Below it is a yellow 'wait' block that contains a green, rounded 'remainder of' block. Inside this block, there are two input fields with the values '17' and '5,' separated by a division symbol ('/'). The unit of time is set to 'seconds,' indicating the robot will wait for the remainder of 17 divided by 5 seconds, which is 2 seconds. After the wait, the sequence continues with a blue 'drive forward for 200 mm' block.

ArcTan2#

The ArcTan2 block is used to perform the atan2(y, x) math function converted from radians to degrees. This function calculates the angle in degrees from the positive x-axis to a point (x, y), where ‘x’ is the horizontal coordinate and ‘y’ is the vertical coordinate.

A green, rounded block from a visual coding interface labeled 'atan2 of X:' followed by an input field with the value '1,' and then 'Y:' followed by another input field with the value '1.' This block is used to calculate the arctangent of the two variables X and Y, which is the angle between the positive x-axis and the point (X, Y) in a 2D coordinate system.

The ArcTan2 block can accept decimals, integers, or numeric blocks.

The ArcTan2 block reports a value in the range of -180 degrees to 180 degrees, representing the angle between the positive x-axis and the point (x, y).

The ArcTan2 block fits in blocks that accept circular spaces, and can accept circular blocks in them as well.

In this example, the Robot will turn to face the coordinate (500, 720).

A visual coding block sequence starting with a yellow 'when started' block. Attached to it is a blue 'turn to heading' block. Inside the block, the heading is specified by a green, rounded 'atan2 of X:' block with an input field for 'X' set to '500' and another input field for 'Y' set to '720.' The unit of measurement is 'degrees,' indicating the robot will turn to the heading calculated by the arctangent of the point (500, 720) in a 2D coordinate system.