Python#
This guide provides detailed information on how to use the Python methods in VEXcode IQ (2nd gen). Here, you will learn how to read and understand each method, with comprehensive descriptions, parameters, and usage examples.
Understanding the Method Entries#
Each method entry in the API Reference includes the following components:
Method Name and Signature: This is the name of the method and its parameters.
Description: A brief explanation of what the method does.
Blocking/Non-Blocking: Indicates whether the method waits for completion before moving to the next method.
Parameters Table: Lists and describes the parameters that the method accepts.
Returns: Describes what the method returns, if applicable.
Example: Provides a sample code snippet demonstrating how to use the method.
Example Method 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, |
Returns: This returns a numerical value.
# Turn to the right for 400 degrees.
drivetrain.turn_for(RIGHT, 400, DEGREES)
# Print the Robot's current angle of rotation.
brain.screen.print(drivetrain.rotation(DEGREES))