VEX V5 C++ API
Public Member Functions | List of all members
vex::encoder Class Reference

Use this class when programming with an encoder. More...

Inherits vex::__tridevice.

Public Member Functions

 encoder (triport::port &port)
 Creates a new encoder object on the port specified in the parameter. More...
 
 ~encoder ()
 
int32_t value ()
 Gets the value of the encoder. More...
 
 operator int ()
 
void resetRotation (void)
 Resets the rotation of the encoder to zero. More...
 
void setRotation (double val, rotationUnits units)
 Sets the rotation of the encoder to a specific value. More...
 
double rotation (rotationUnits units)
 Gets the rotation value of the encoder. More...
 
double velocity (velocityUnits units)
 Gets the velocity of the encoder. More...
 

Detailed Description

Use this class when programming with an encoder.

Constructor & Destructor Documentation

◆ encoder()

vex::encoder::encoder ( triport::port port)

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

Parameters
portA reference to a three wire port.

◆ ~encoder()

vex::encoder::~encoder ( )

Member Function Documentation

◆ value()

int32_t vex::encoder::value ( )

Gets the value of the encoder.

Returns
Returns an integer that represents the value of the encoder device.

◆ operator int()

vex::encoder::operator int ( )

◆ resetRotation()

void vex::encoder::resetRotation ( void  )

Resets the rotation of the encoder to zero.

◆ setRotation()

void vex::encoder::setRotation ( double  val,
rotationUnits  units 
)

Sets the rotation of the encoder to a specific value.

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

◆ rotation()

double vex::encoder::rotation ( rotationUnits  units)

Gets the rotation value of the encoder.

Returns
Returns a double that represents the current rotation of the encoder.
Parameters
unitsThe measurement unit for the encoder device.

◆ velocity()

double vex::encoder::velocity ( velocityUnits  units)

Gets the velocity of the encoder.

Returns
Returns a double that represents the current velocity of the encoder.
Parameters
unitsThe measurement unit for the encoder device.