VEXcode Doxygen
Public Member Functions | List of all members
vex::servo Class Reference

Use this class when programming with a servo device. More...

#include <vex_triport.h>

Inheritance diagram for vex::servo:
vex::__tridevice

Public Member Functions

 servo (triport::port &port)
 Creates a new servo object on the port specified in the parameter. More...
 
void setPosition (int32_t value, percentUnits units)
 Sets the position of the servo device. More...
 
void setPosition (double value, rotationUnits units)
 Sets the position of the servo device. More...
 
void startRotateTo (int32_t value, percentUnits units)
 Sets the position of the servo device. More...
 
void startRotateTo (double value, rotationUnits units)
 Sets the position of the servo device. More...
 

Detailed Description

Use this class when programming with a servo device.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ servo()

vex::servo::servo ( triport::port port)

Creates a new servo object on the port specified in the parameter.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::servo Servo = vex::servo(Brain.ThreeWirePort.A);}

Parameters
portA reference to a three wire port.

Member Function Documentation

◆ setPosition() [1/2]

void vex::servo::setPosition ( double  value,
rotationUnits  units 
)

Sets the position of the servo device.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Servo.setPosition(45, vex::rotationUnits::deg);}

Parameters
valueSets the amount of rotation.
unitsThe measurement unit for the rotation value.

◆ setPosition() [2/2]

void vex::servo::setPosition ( int32_t  value,
percentUnits  units 
)

Sets the position of the servo device.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Servo.position(10, percent);} @cpp_sig{Servo.setPosition(10, vex::percentUnits::pct);}

Parameters
valueSets the amount of rotation.
unitsThe measurement unit for the rotation value.

◆ startRotateTo() [1/2]

void vex::servo::startRotateTo ( double  value,
rotationUnits  units 
)
inline

Sets the position of the servo device.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Servo.startRotateTo(45, degrees);} @cpp_sig{Servo.startRotateTo(45, vex::rotationUnits::deg);}

Parameters
valueSets the amount of rotation.
unitsThe measurement unit for the rotation value.

◆ startRotateTo() [2/2]

void vex::servo::startRotateTo ( int32_t  value,
percentUnits  units 
)
inline

Sets the position of the servo device.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Servo.startRotateTo(10, percent);} @cpp_sig{Servo.startRotateTo(10, vex::percentUnits::pct);}

Parameters
valueSets the amount of rotation.
unitsThe measurement unit for the rotation value.

The documentation for this class was generated from the following file: