Blocks#

This guide provides detailed information on how to use the Blocks in VEXcode IQ (2nd gen). Here, you will learn how to read and understand each block, with comprehensive descriptions, parameters, and usage examples.

Understanding the Block Entries#

Each block entry in the API Reference includes the following components:

  • Block Name and Image: This is the name of the block and an image of the block.

  • Description: A brief explanation of what the block does.

  • Parameters: Screenshots showing all the available parameters for that block with expanded drop-downs.

  • Example: Provides an image demonstrating how to use the block in VEXcode.

Example Block Entry#

spin for#

The spin for block spins a selected motor or motor group for a specific amount of rotation using the current motor velocity, measured in degrees or turns.

aria-description goes here#
  spin [Motor1 v] [forward v] for (90) [degrees v] ▶

Parameters

Description

motor

The motor or motor group to spin, configured in the Devices window.

direction

The direction to spin, configured in the Devices window. By default this is:

  • counterclockwise (forward)
  • clockwise (reverse)

distance

The rotation amount, as an integer or decimal.

unit

The unit of measurement representing the distance:

  • degrees
  • turns

expanding arrow

By default, this is a waiting block, so the drivetrain will finish moving before running the next block. To make the drivetrain start moving and immediately run the next block right away, expand the block to say and don’t wait.

Example

aria-description goes here#
  when started
  [Spin the motor for one turn.]
  spin [Motor1 v] [forward v] for (1) [turns v] ▶