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.

Understanding the Command Entries#

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

  • Command Name and Signature: This is the name of the command and its parameters.

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

  • Blocking/Non-Blocking: Indicates whether the command waits for completion before moving to the next command.

  • Parameters Table: Lists and describes the parameters that the command accepts.

  • Returns: Describes what the command returns, if applicable.

  • Example: Provides a sample code snippet demonstrating how to use the command.

Example Command Entry#

Drivetrain.rotation()#

The Drivetrain.rotation(units) method returns the Drivetrain’s angle of rotation. The numerical value (the degrees) will increase when rotating clockwise and decrease when rotating counter-clockwise.

Parameters

Description

units

The unit of the returned value, degrees.

Returns: This returns a numerical value.

// 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));