C++#
Esta guía proporciona información detallada sobre cómo usar los comandos de C++ en VEXcode IQ (2.ª generación). Aquí aprenderá a leer y comprender cada comando, con descripciones completas, parámetros y ejemplos de uso.
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.
Ejemplo de entrada de comando#
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)
Parámetros |
Descripción |
---|---|
unidades |
Optional. The unit that represents the rotational 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));