1. Non-Blocking Code Blocks In normal programming code, each code block must be executed completely before the next block is run. This means, for example, that you can only have one robot moving at a time. Sometimes, however, you want multiple robots to move together. It's possible to do this using a special type of block called Non-Blocking (NB) blocks. With a "non-blocking" block, RoboBlockly will start the block's execution and then immediately move on to the next blocks in sequence while the non-blocking block continues executing. That is, the "non-blocking" block does not block execution of later blocks (thus the name "non-blocking").
2. The driveDistanceNB Block An example of a non-blocking block is the driveDistanceNB block:
3. The moveWait Block We also use the moveWait block with non-blocking blocks to wait for all the non-blocking action to finish before ending the program:
Watch the video to learn more about how to use non-blocking blocks.
4. Turn Off Trace for Proper Operation
You can also turn off the trace without having to use any blocks in the code. To do so open the Robot Settings section below the grid and uncheck the Trace Position checkbox:
5. The turnNB Block The turn blocks are also available in non-blocking (NB) versions (see Example 4)
For more tips on using non-blocking blocks, see the lesson linked in the More Info button at top right.
|
driveDistanceNB, moveWait, turnNB
|
Drive Robot 1 forward 10 units and Robot 2 forward 5 units at the same time. This example uses the trace on/off block to turn off the trace. |
The example drives Robot 1 forward 10 units and Robot 2 forward 5 units at the same time. But note that in this example the "moveWait" block is not used at the end. So the program ends after Robot 2 reaches the end of its move, and thus Robot 1 also stops at that point without driving the full 10 units. |
The example drives Robot 1 forward 5 units and Robot 2 forward 10 units at the same time. Like in Example 2, the "moveWait" block is not used at the end. So the program ends after Robot 2 reaches the end of its move. But the Robot 1 movement is not affected because in this example it moves a shorter distance than Robot 2 and thus finishes before Robot 2 finishes. You may want to add the moveWait() block for Robot 1 so that the distance for Robot 1 can be changed to a larger value without changing the program structure. |
The example uses non-blocking driveDistanceNB and turnNB blocks to that the two robots mirror each other's movements. Because they are doing the exact same movements at the same times, moveWait blocks are not needed. This example also uses the Trace Position checkbox in the Robot Settings section to turn off the trace, instead of the trace on/off block. |
Grid Size: S M L | Simple View: | MinView: |
![]() |
|
Coord: x-axis y-axis | Grid Lines: x-axis y-axis | |||
Grid: | 12x12 inches | 24x24 inches | 36x36 inches | |
72x72 inches | 96x96 inches | 192x192 inches | ||
1x1 inches | 2x2 inches | Fraction: | ||
xy-Range: | ||||
|
||||
|
||||
Quad: | 1 Quadrant | 4 Quadrants | 1&4 Quadrants | |
Units: | US Customary | Metric | Ruler: |
Labels: |
|
|
|
Font
px
|
|
Tics Lines: |
|
Width
px
|
Hash Lines: |
|
Width
px
|
|
|||||||||||
|
|||||||||||