Using My Blocks in VEXcode 123

My Blocks is one of the block categories within VEXcode 123. Some other categories include Looks, Sound, Sensing, and Variables. My Blocks are used to create a sequence of blocks that can be used multiple times throughout a project.


How to Make a Block

VEXcode 123 Toolbar with the My Blocks section shown and the Make a Block button highlighted.

Select ‘Make a Block’ from the My Blocks category.

VEXcode 123 Make a Block menu is open and the name of the block has been changed to Drive in and is highlighted. The blue Ok button on the bottom right is highlighted.

Rename the block by entering in the ‘Block Name’ field, then select ‘OK.’


How to Customize a Block

Add an input (number)

VEXcode 123 Make a Block menu is open and the name of the block is set to Drive in. A number input field has been added to the block and is now highlighted.

Select the ‘Add an input (number)’ option from the ‘Make a Block’ screen. Rename the input by entering in the ‘number’ field, then select ‘OK.’

Add a input (Boolean)

VEXcode 123 Make a Block menu is open and the name of the block is set to Drive in. A boolean input field has been added to the block and is now highlighted.

Select the ‘Boolean’ option from the ‘Make a Block’ screen. Rename the input by entering in the ‘boolean’ field, then select ‘OK.’

Add a label

VEXcode 123 Make a Block menu is open and the name of the block is set to Drive in. A label field has been added to the block and is now highlighted.

Select the ‘Add a label’ option from the ‘Make a Block’ screen. Rename the label by entering in the ‘Label Text’ field, then select ‘OK.’

Combine inputs and labels

VEXcode 123 Make a Block menu is open and a custom block has been created. The block first reads Drive in, then has a number input field, and then ends with a label reading step square. All together the custom block reads Drive in X step square. The blue Ok button on the bottom right is highlighted.

Combine inputs and labels together in order to create a sequence of blocks, then select ‘OK.’


How to Delete Inputs / Labels

VEXcode 123 Make a Block menu is open and the name of the block is set to Drive in. A number input field has been added to the block, and the Clear icon above it is highlighted.

To delete an input or label, select the ‘Clear’ icon on top of the input or label that you wish to remove.


How to Use the Define Block

VEXcode 123 My Blocks Definition block is highlighted. It reads 'Drive in number step square', and the number is a parameter that can be used in the block definition.

A parameter can now be used from the {Define} block once it is created.

The Drive in VEXcode 123 My Blocks Definition block with a definition now added to it. The stack has a Repeat block set to 4, and a Drive for 1 step block with a Turn for 90 degrees block both inside the repeat block.

Attach additional blocks to the {Define} block.

The Drive in VEXcode 123 My Blocks Definition block with the number parameter now used in the definition. The stack has a Repeat block set to 4, and a Drive for block with a Turn for 90 degrees block inside the repeat block. The number parameter has been placed in the Drive for block, so it now reads Drive forward for number steps.

Use parameters from the {Define} block.

VEXcode 123 My Blocks Command block added below a When Started block. This command block will call the Drive in number step square command. The number parameter is set to 1.

Use the [My Block] attached to the {When Started} block.


How to Use My Blocks

Driving in Squares Example

VEXcode 123 When Started block that has three blocks below it. First is a Drive in 1 step square command block, then Turn right for 45 degrees, and then a Drive in 2 step square command block.

In this example, the 123 Robot will use My Blocks to:

  • Drive forward in a 1 step square.
  • Turn right 45 degrees.
  • Drive forward in a 2 step square.

The {Define} hat block breaks down a procedure. In the following example, this {Define} hat block breaks down the blocks used to drive in a square a certain number of times. Drag arguments from the {Define} block to be used within the blocks.

Once the {Define} block is set, the newly created block can now be dragged and added to the {When Started} block to set parameters.

The previous VEXcode 123 blocks stack using the Drive in number step square command block shown side by side with the command block's definition.

Once the parameters are changed, the project is ready to be started.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: