Using My Blocks in VEXcode IQ

 My Blocks is one of the block categories within VEXcode IQ. 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

Screenshot of a VEX IQ Blocks programming interface, illustrating how to create a block for robotics programming, part of the Blocks Tutorials in the VEX IQ knowledge base.

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

Screenshot showing the process of renaming a block in VEXcode IQ, illustrating the user interface elements and options available for modifying block names in programming for VEX IQ robotics.

Rename the block by entering in the “block name” field, then select “OK.”


How to Customize a Block

Add an input (number)

Screenshot of a VEXcode IQ interface showing an input field for entering a number, used in the context of programming tutorials for the VEX IQ Robotics platform.

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)

Screenshot of a VEXcode IQ programming interface displaying a boolean block tutorial, illustrating how to use boolean logic in robotics programming for VEX IQ educational projects.

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

Screenshot showing the process of adding a label in VEXcode IQ, illustrating the interface and options available for programming VEX IQ robots in the Blocks Tutorials section of the knowledge base.

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

Diagram illustrating the combination of input fields and labels in VEXcode IQ, demonstrating best practices for user interface design in robotics programming tutorials.

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


How to Delete Inputs / Labels

Screenshot of a delete label input interface in VEXcode IQ, illustrating the process of removing a label from a block in the programming environment, relevant to VEX IQ robotics tutorials.

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

Diagram illustrating the concept of a block in VEXcode IQ programming, used in the Blocks Tutorials section of the VEX IQ knowledge base, aimed at helping beginners understand programming concepts for robotics projects.

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

Diagram illustrating how to add blocks in VEXcode IQ to define robot actions, part of the Blocks Tutorials in the VEX IQ knowledge base, aimed at educating beginners in robotics programming.

Attach additional blocks to the “define” block.

Diagram illustrating the use of parameters in a define block for VEX IQ programming, showcasing how to customize functions and enhance robot functionality in educational robotics projects.

Use parameters from the “define” block.

Flowchart illustrating the steps to attach a component in VEX IQ programming, part of the Blocks Tutorials section for educational resources on the VEX IQ Robotics platform.

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


How to Use My Blocks

Play Siren Example

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

  • Play the siren sound 3 times
  • Drive forward for 12 inches
  • Play the siren sound 6 times

The “define” hat block breaks down a procedure. In the following example, this “define” hat block breaks down the blocks used to play a siren sound 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 a VEX IQ Blocks tutorial demonstrating how to program a siren sound in a robotics project, featuring block coding elements and visual programming interface.

Once the parameters are changed, the project is ready to be downloaded and run.

Print with New Line Example

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

  • Drive forward for 15 inches
  • Print the battery capacity and also move the cursor to a new line on the Brain’s screen
  • Turn the robot 180 degrees to the right
  • Print the battery capacity and also move the cursor to a new line on the Brain’s screen

 

The “define” hat block breaks down the blocks used to print sensor reporter values and then move to a new line. 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 a VEX IQ Blocks tutorial interface, showcasing programming blocks and options for building robotics projects, designed for educational purposes and beginner robotics enthusiasts.

Once the parameters are changed, the project is ready to be downloaded and run.

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

Last Updated: