My Block Builder

Sometimes you make a great mini-program that you want to use again in another Project or Program.

The My Block Builder helps you take this mini-program, which is a number of blocks you select in the work area, and group them together to create a My Block.

Over time you may develop a library of My Blocks that you can trade with other MINDSTORMS users.
Creating a My Block
Let’s suppose you’ve made a mini-program that makes your robot drive in a square:




To convert this mini-program into a block, use the Select tool and select all the blocks you want by dragging a box around them.

Select “My Block Builder” from the Tools menu to start the My Block Builder.



Give your block a name and a short description.

Select one of the My Block icons to help identify your block. This example makes the robot drive in a square, so we’ll use an icon with motors.

Click Finish.

Your mini-program will now be converted into its very own block! All the My Blocks you create for a Project appear in the My Blocks palette.



You can drag the new My Block onto the Programming Canvas to use it in your program.



Double click on the My Block if you want to edit any part of it.
Doing More with My Blocks
The My Block we just created to make a square is great, but what happens if you want a bigger square? Or if you want the robot to drive in a square faster? What if you want a triangle?

You could go into the My Block and change the inputs each time, but there is a better way.

Set up your mini-program, just as you did for the first My Block: Select the blocks you want, then Select “My Block Builder” in the Tools menu to start the My Block Builder.

Fill in all the sections just as you did for the first My Block, but don’t click Finish just yet. Instead, click the + symbol on the My Block to add a parameter.





In the Parameter Setup Tab, fill in the appropriate information. This will let us control how big our square will be.

Set the Default Value, for example, to 1000, just in case you forget to set it when using the My Block in your own programs. You can even select a slider bar style for your parameter.

In the Parameter Icons tab, select an appropriate image for the parameter. In this example we are controlling the distance the robot will drive when making a square, so a straight arrow seems appropriate.





Now that you have added your parameter, click Finish.

The new parameter, “Distance”, needs to be connected to the input in the mini-program before we can control it.



Connect the wire coming out of your parameter Distance into the Degrees input of the first Move Tank block. This lets us control how large a square the robot will drive (see Data Wires for more information).




Move back to your main program, and you will now see your My Block, but this time with a parameter to set the side length for the square mini-program. Depending on the Parameter Style selected above, you can either enter the value directly or use the slider bars.

What if you want your robot to drive in a triangle or hexagon?

Here’s the same My Block, but this time with parameters to control:

1. The distance to drive for each side (Distance),
2. How fast the robot goes (Speed),
3. What angle to turn for each corner, and
4. How many times to repeat the driving commands.





Tips and Tricks
You can change the order of the parameters on the block in the My Block Builder. Click on the left or right arrows to move the selected parameter.



Move parameter left
Move Parameter right
Delete Parameter
My Block Builder
Quick links