Servo#
To make Servo commands appear in VEXcode V5, a Servo Motor must be configured in the Devices window.
Initializing the Servo Class#
A Servo Output is created by using the following constructor:
Servo(port)
This constructor uses one parameter:
| Parameter | Description | 
|---|---|
| 
 | The 3-Wire Port to use for the Servo Output, whether it’s a port on the  | 
A Brain or 3-Wire Expander must be created first before they can be used to create an object with the Servo Class constructor.
# Create the Brain.
brain = Brain()
# Construct a Servo Output "servo" with the Servo class.
servo = Servo(brain.three_wire_port.a)
This Servo object will be used in all subsequent examples throughout this API documentation when referring to Servo class methods.
Class Methods#
set_position()#
The set_position(value, units) method sets the position of the Servo.
| Parameters | Description | 
|---|---|
| 
 | The new value for the Servo. | 
| 
 | Optional. A valid  | 
Returns: None.
# Set the Servo Output to 10 degrees.
servo.set_position(10, DEGREES)