C++#

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

Reading a Command Entry#

Each command entry follows a consistent structure:

  • Command Name – The official name of the command.

  • Description – A brief explanation of what the command does and what it may return.

  • Definition – The syntax of the command, showing how it should be written in code.

  • Parameter Table – Lists all inputs the command accepts.

  • Example Code – A usage example provided as a copy-and-paste code block.

Example Command Entry#

rotation#

rotation returns the current rotational value of a smart drivetrain as a double.

Note: This method will only work with a drivetrain that has been configured with a Gyro Sensor or Brain Inertial Sensor.

Usage:
Drivetrain.rotation(units)

Parameters

Description

units

Optional. The unit that represents the rotational value:

  • degrees (default)
  • turns

// Turn to the right for 400 degrees.
Drivetrain.turnFor(right, 400, degrees);
// Print the Robot's current angle of rotation.
Brain.Screen.print(Drivetrain.rotation(degrees));