Control#

Wait#

The Wait block is used to wait for a specific amount of time before moving to the next block.

wait_block

Choose an amount of time to wait.

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

In this example, the VR Robot will drive forward for 4 seconds before stopping.

wait_example

Repeat#

The Repeat C block is used to repeat the blocks contained inside for a set number of times.

repeat_block

First enter a value to indicate how many times the stack will repeat the blocks contained inside.

The Repeat C block can accept integers or numeric blocks.

C blocks can also be put inside of each other. This concept is called nesting which can help save time when programming different behaviors.

In this example, the VR Robot will drive forward for 400 Millimeters and turn right by 90 degrees 4 times in a row to make a square.

repeat_example

Forever#

The Forever C block is used to repeat any blocks contained inside forever.

forever_block

Place blocks in a Forever C block to have those actions repeat forever.

You can exit a Forever C block by placing a break block inside.

C blocks can also be put inside of each other. This concept is called nesting which can help save time when programming different behaviors.

In this example, the Forever block is used to continuously check if the Left bumper has been pressed as the VR Robot drives forward.

forever_example

If then#

The If then C block is used to run the blocks inside, if the Boolean condition reports True.

if_then_block

The If then C block will only check the Boolean condition once.

If the Boolean condition reports True, the blocks inside of the C block will run.

If the Boolean condition reports False, the blocks inside of the C block will be skipped.

The If then C block can accept hexagonal (six-sided) shaped blocks as its condition.

In this example, the If then block is continuously checked to see if the Left Bumper is pressed. If the bumper is pressed, the Drivetrain will stop.

if_then_example

If then else#

The If then else C block is used to run the blocks inside the first or second parts of the if then else, based on the Boolean value reported.

if_then_else_block

The If then else C block will only check the Boolean condition once.

If the Boolean condition reports True, the blocks inside of the if section will be run.

If the Boolean condition reports False, the blocks inside of the else section will be run.

The If then else C block can accept hexagonal (six-sided) shaped blocks as its condition.

In this example, the If then else block is continuously checked to see if the Front Distance Sensor has detected an object. If the sensor detected an object, the VR Robot will drive forward, otherwise, it will turn to the right.

if_then_else_example

If then else if then else#

The If then else if then else C block is used to run the blocks inside the first set of internal blocks in the If then else if then else C block where the condition returns True.

elif_block

The If then else if then else C block will only check the Boolean condition once.

If the Boolean condition reports True, the blocks inside the if section will run.

If the Boolean condition reports False, the If then else if then else C block will check the first of the else if lines. For each else if line, the block will check if the Boolean condition is reports True. If it is true, the internal blocks directly under that line will run before continuing on to the next block under the If then else if then else C block.

If all the Boolean conditions for the else if lines report False, the blocks inside of the else section will be run.

The If then else if then else C block can accept hexagonal (six-sided) shaped blocks as its condition.

To add another else if condition, click on the + on the else line. This will add a new else if condition to the bottom of the current list.

To remove an else if condition, click on the - on the else line. This will remove the last else if condition line, but will not delete any used blocks in the condition.

In this example, the If then else if then else block is checked continuously to see if the Down Eye Sensor has detected the color green, then blue. If it detects the color green, the VR Robot will turn right by 90 degrees, If it detects the color blue, the VR Robot will turn left by 90 degrees. If the Down Eye Sensor detects nothing, the VR Robot will drive forward.

elif_example

Wait until#

The Wait until block is used to wait for a Boolean block to report True before moving to the next block.

wait_until_block

The Wait until block will repeatedly check a Boolean reporter block and will not move to the next block until the Boolean report block reports True.

The Wait until Boolean block can accept hexagonal (six-sided) shaped blocks.

In this example, the VR Robot will drive forward until its current Y position in Millimeters is greater than 300, then it will stop.

wait_until_example

Repeat until#

The Repeat until C block is used to repeat the blocks inside until the Boolean condition reports True.

repeat_until_block

The Repeat until C block will only check the Boolean condition at the beginning of each loop.

If the Boolean condition reports False, the blocks inside of the block will run.

If the Boolean condition reports True, the blocks inside of the block will be skipped.

The Repeat until C block can accept hexagonal (six-sided) shaped blocks as its condition.

In this example, the VR Robot will move forward in 100 Millimeter increments, waiting 1 second after each movement. The Repeat until block will repeat those movements until the Y position of the VR Robot is greater than 300 Millimeters.

repeat_until_example

While#

The While C block is used to repeat the blocks inside while the Boolean condition reports True.

while_block

The While C block will only check the Boolean condition at the beginning of each loop.

If the Boolean condition is reports True, the blocks inside of the block will run.

If the Boolean condition is reports False, the blocks inside of the block will be skipped.

The While C block can accept hexagonal (six-sided) shaped blocks as its condition.

In this example, the VR Robot will drive forward while the Brain’s timer is less than 3 seconds. Once the timer is greater than 3 seconds, the Drivetrain will stop.

while_example

Break#

The Break block is used to exit a repeating loop immediately.

break_block

When added to a repeating C block, the Break block will exit the loop it is currently in.

In this example, the VR Robot will drive forward until the Front Eye Sensor detects that it is near an object. Once detected, it will stop checking the If then statement and stop the Drivetrain.

break_example

Stop project#

The Stop project block is used to stop a running project

stop_block

In this example, the VR Robot will drive forward for two seconds before the project stops.

stop_example