VEX V5 Python API
Public Member Functions | List of all members
vex.Encoder Class Reference

Inherits vex.TriDevice.

Public Member Functions

def __init__ (self, triport_port)
 Use this class when programming with an encoder. More...
 
def value (self)
 Gets the value of the encoder. More...
 
def reset_rotation (self)
 Resets the rotation of the encoder to zero. More...
 
def set_rotation (self, value, rotationUnits=RotationUnits.DEG)
 Sets the rotation of the encoder to a specific value. More...
 
def rotation (self, rotationUnits=RotationUnits.DEG)
 Gets the roation value of the encoder. More...
 
def velocity (self, velocityUnits=VelocityUnits.PCT)
 Gets the velocity of the encoder. More...
 

Constructor & Destructor Documentation

◆ __init__()

def vex.Encoder.__init__ (   self,
  triport_port 
)

Use this class when programming with an encoder.

Member Function Documentation

◆ value()

def vex.Encoder.value (   self)

Gets the value of the encoder.

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

◆ reset_rotation()

def vex.Encoder.reset_rotation (   self)

Resets the rotation of the encoder to zero.

◆ set_rotation()

def vex.Encoder.set_rotation (   self,
  value,
  rotationUnits = RotationUnits.DEG 
)

Sets the rotation of the encoder to a specific value.

Parameters
valueA double that represents the value to set the rotation to.
rotationUnitsThe unit type that the previous value should be treated as.

◆ rotation()

def vex.Encoder.rotation (   self,
  rotationUnits = RotationUnits.DEG 
)

Gets the roation value of the encoder.

Parameters
rotationUnitsA unit type that defines what value of roation that should be returned.
Returns
Returns a double that represents the current rotation of the encoder.

◆ velocity()

def vex.Encoder.velocity (   self,
  velocityUnits = VelocityUnits.PCT 
)

Gets the velocity of the encoder.

Parameters
velocityUnitsA unit type that defines what value of velocity that should be returned.
Returns
Returns a double that represents the current velocity of the encoder.