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

Use this class when programming with a potentiometer. More...

#include <vex_triport.h>

Inheritance diagram for vex::pot:
vex::__tridevice

Public Member Functions

 pot (triport::port &port)
 Creates a new pot object on the port specified in the parameter. More...
 
int32_t value (analogUnits units)
 Gets the value of the potentiometer in the units defined in the parameter. More...
 
int32_t value (percentUnits units)
 Gets the value of the potentiometer in the units defined in the parameter. More...
 
int32_t angle (percentUnits units=percentUnits::pct)
 
double value (rotationUnits units)
 Gets the value of the potentiometer in the units defined in the parameter. More...
 
double angle (rotationUnits units)
 
void changed (void(*callback)(void))
 Calls a function when the potentiometer value changes. More...
 

Public Attributes

mevent & CHANGED = _CHANGED
 

Detailed Description

Use this class when programming with a potentiometer.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ pot()

vex::pot::pot ( triport::port port)

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

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

Parameters
portA reference to a three wire port.

Member Function Documentation

◆ changed()

void vex::pot::changed ( void(*)(void)  callback)

Calls a function when the potentiometer value changes.

@prog_lang{pro} @drawer_cat{sensing} @block_sig{Pot.changed(changedFunction);}

Parameters
callbackA reference to a function.

◆ value() [1/3]

int32_t vex::pot::value ( analogUnits  units)

Gets the value of the potentiometer in the units defined in the parameter.

@prog_lang{cpp|pro} @drawer_cat{sensing} @block_sig{Pot.value(vex::analogUnits::range8bit)}

Returns
Returns an integer that represents the unit value specified by the parameter of the potentiometer device.
Parameters
unitsThe measurement unit for the potentiometer device.

◆ value() [2/3]

int32_t vex::pot::value ( percentUnits  units)
inline

Gets the value of the potentiometer in the units defined in the parameter.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Pot.value(percent)} @cpp_sig{Pot.value(vex::percentUnits::pct)}

Returns
Returns an integer that represents the unit value specified by the parameter of the potentiometer device.
Parameters
unitsThe measurement unit for the potentiometer device.

◆ value() [3/3]

double vex::pot::value ( rotationUnits  units)

Gets the value of the potentiometer in the units defined in the parameter.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Pot.value(degrees)} @cpp_sig{Pot.value(vex::rotationUnits::deg)}

Returns
Returns an integer that represents the unit value specified by the parameter of the potentiometer device.
Parameters
unitsThe measurement unit for the potentiometer device.

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