VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
vex::distance Class Reference

Use the distance class to control the distance sensor. More...

#include <vex_distance.h>

Inheritance diagram for vex::distance:
vex::device

Public Member Functions

 distance (int32_t index)
 Creates a new distance sensor object on the port specified.
 
bool installed ()
 
int32_t value ()
 
double objectDistance (distanceUnits units)
 Gets the detected object distance.
 
sizeType objectSize (void)
 Gets an estimate of the detected object size.
 
int32_t objectRawSize (void)
 Gets an estimate of the detected object size.
 
double objectVelocity (void)
 Gets an estimate of the detected object velocity.
 
bool isObjectDetected (void)
 check for object in range of the distance sensor
 
void changed (void(*callback)(void))
 Calls a function when the distance value changes.
 
- Public Member Functions inherited from vex::device
 device (int32_t index)
 
IQ_DeviceType type ()
 
int32_t index ()
 
void init (int32_t index)
 
int32_t readDigitalPin ()
 
int32_t readAnalogPin ()
 

Additional Inherited Members

- Protected Member Functions inherited from vex::device
void setPollInterval (int32_t value)
 
bool pollValid (bool bSave)
 
- Protected Attributes inherited from vex::device
int16_t _index
 

Detailed Description

Use the distance class to control the distance sensor.

Definition at line 26 of file vex_distance.h.

Constructor & Destructor Documentation

◆ distance()

vex::distance::distance ( int32_t index)

Creates a new distance sensor object on the port specified.

Parameters
indexThe port index for this sensor. The index is zero-based.

Member Function Documentation

◆ changed()

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

Calls a function when the distance value changes.

Parameters
callbackA reference to a function.

◆ installed()

bool vex::distance::installed ( )
virtual

Reimplemented from vex::device.

◆ isObjectDetected()

bool vex::distance::isObjectDetected ( void )

check for object in range of the distance sensor

Returns
Returns true if an object is detected

◆ objectDistance()

double vex::distance::objectDistance ( distanceUnits units)

Gets the detected object distance.

Returns
Returns a double that represents the unit value specified by the parameter of the distance sensor.
Parameters
unitsThe measurement unit for the distance sensor.

◆ objectRawSize()

int32_t vex::distance::objectRawSize ( void )

Gets an estimate of the detected object size.

Returns
Returns a integer that represent a relative object size, 0 to 400

◆ objectSize()

sizeType vex::distance::objectSize ( void )

Gets an estimate of the detected object size.

Returns
Returns the estimated object size

◆ objectVelocity()

double vex::distance::objectVelocity ( void )

Gets an estimate of the detected object velocity.

Returns
Returns a double with object velocity in m/s

◆ value()

int32_t vex::distance::value ( )
virtual

Reimplemented from vex::device.


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