Python#
This guide provides detailed information on how to use the Python methods in VEXcode VR. Here, you will learn how to read and understand each command, with comprehensive descriptions, parameters, and usage examples.
Understanding the Method Entries#
Each method entry in the API Reference includes the following components:
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 Method Entry#
rotation#
rotation returns the current rotational value of a drivetrain as a float.
Usage:
drivetrain.rotation(units)
Parameters |
Description |
|---|---|
|
The unit used to represent the rotational value:
|
def main():
# Display the rotation after turning
drivetrain.turn_for(RIGHT, 450, DEGREES)
brain.print("Rotation: ")
brain.print(drivetrain.rotation(DEGREES))
# VR threads — Do not delete
vr_thread(main)