NXT-G and MyBlocks
MyBlocks: A MyBlock is a user defined segment of code that resides within one programming block.
The user can take multiple blocks and "group" them together into a block that can be reused in different programs.
This is similar to defining methods or functions in other programming languages.
Generally, if you are using a sequence of blocks more than twice in a program - you should turn it into a MyBlock. (Examples include Dark Stops and Line Following).
Directions for making a MyBlock.
1. Select the Blocks you wish to group together. (In this example, we are going to group a "Dark Stop" routine.
2. Click the MyBlock icon.
3. Name your MyBlock - use a name that describes the MyBlock action. Example: "DarkStop"
4. Click Next.
5. Drag icons to "decorate" your block. This will give you a visual cue as to the purpose of the block. In this example, we will use a Stop Sign and a Light for "Dark Stop".
6. Click "Finish"
7. The computer saves the MyBlock and puts it back into the original program.
8. You can access the MyBlock from the MyBlocks menu.