Using My Blocks in VEXcode VR

My Blocks is one of the block categories within VEXcode VR. Some other categories include Magnet, Looks, 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

Screenshot of the VEXcode VR blocks category interface, showcasing various programming blocks available for users to create code in a virtual environment, designed to facilitate learning coding concepts and robotics principles.

Select “Make a Block” from the My Blocks category.

Illustration depicting a coding flowchart for VEXcode VR, demonstrating programming concepts in a virtual robot environment, aimed at enhancing STEM education through tutorials.

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


How to Customize a Block

Add an input (number)

VEXcode VR tutorial image showing a visual representation of coding blocks used for programming a virtual robot, illustrating coding concepts for beginners and advanced users in an educational STEM context.

Select the, “Add an Input (number)” option from the “Make a Block (Preview)” screen. Rename the input by entering in the “Number” field, then select “OK.”

Add an input (boolean)

Diagram illustrating Boolean logic concepts in VEXcode VR, featuring visual representations of AND, OR, and NOT operations, designed to aid learners in understanding coding principles within the programming environment.

Select the, “Add an Input (Boolean)” option from the “Make a Block (Preview)” screen. Rename the input by entering in the “Boolean” field, then select “OK.”

Add a label

VEXcode VR square label graphic, illustrating key features of the online programming environment for coding with a virtual robot, used in tutorials for STEM education.

Select the, “Add a label” option from the “Make a Block (Preview)” screen. Rename the label by entering in the “Label Text” field, then select “OK.”

Combine inputs and labels

Screenshot illustrating the combination of input fields and labels in VEXcode VR, showcasing the block-based coding interface designed for teaching coding concepts and robotics principles in an educational setting.

Combine inputs and labels together in order to create a sequence of blocks.


How to Delete Inputs / Labels

Screenshot of the VEXcode VR interface showing the 'Delete' input option, illustrating the programming environment for users to learn coding concepts through virtual robotics.

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

Screenshot of the VEXcode VR block-based coding interface, showcasing various programming blocks used for coding a virtual robot, illustrating a tutorial on coding concepts for beginners in a STEM education context.

A parameter can now be used from the “Define” block once it is created.

Screenshot of VEXcode VR interface showing blocks used to define programming actions for a virtual robot, illustrating the block-based coding environment designed for educational purposes in STEM learning.

Attach additional blocks to the “Define” block.

Screenshot of VEXcode VR interface showing a drag-and-drop action where a number is being moved to a parameter, illustrating the block-based coding process in a virtual programming environment for educational purposes.

Use parameters from the “Define” block.

Screenshot of VEXcode VR interface showing the 'Draw a Square' block in the My Blocks section, illustrating the block-based coding environment for programming a virtual robot.

Use the “My Block” attached to the “When Started” block.


How to Use My Blocks

Drawing Squares Example

In this example, the robot will use My Blocks to:

  • Drive forward 200 mm
  • Draw a 300 mm square with the black pen
  • Turn right for 25 degrees
  • Draw a 500 mm square with the red pen

The “Define” hat block breaks down a procedure. In the following example, this “Define” hat block breaks down the blocks used to draw 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.

Screenshot of VEXcode VR tutorial showing two squares created using block-based coding in the programming environment, illustrating coding concepts for beginners in a virtual robot simulation.

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: