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 the robot normally cannot blink and move at the same time. But we can get around this restriction by using a special type of block called Non-Blocking (NB) blocks. With a "non-blocking" block, RoboBlocky 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. Blinking and Moving at the Same Time The blinkLED code block allows us to blink the LED light on the robot (whether it's a virtual robot or a hardware robot). But it doesn't enable the robot to blink and move at the same time. To do this, we use the "blinkLEDNB" code block, where "NB" stands for non-blocking:
Two important things: 1. If RoboBlocky comes to the end of the program before the blinking is done, it will prematurely end the blinking as well. If you don't want the program to end until the blinking is done, then you must use the blinkWait command at the end of the code:
Click the Video button at the top left to learn more about the blinkLEDNB instruction and the non-blocking concept.
|
Non-Blocking (NB) blocks, blinkLEDNB, blinkWait
|
The example blinks and drives at the same time using the blinkLEDNB and driveDistance blocks. |
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
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
(
,
in
) in
|
|
degrees
|
|
|
|||||||||||
|
|||||||||||