VEXcode Doxygen
vex_distance.h
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) Innovation First 2019, All rights reserved. */
4 /* */
5 /* Module: vex_distance.h */
6 /* Author: James Pearman */
7 /* Created: 26 May 2020 */
8 /* */
9 /* Revisions: */
10 /* V1.00 TBD - Initial release */
11 /* */
12 /*----------------------------------------------------------------------------*/
13 
14 #ifndef VEX_DISTANCE_CLASS_H
15 #define VEX_DISTANCE_CLASS_H
16 
17 /*-----------------------------------------------------------------------------*//*---------------------------------------------------------------------------*/
21 
22 namespace vex {
26  class distance : public device {
27  private:
28  enum class tEventType {
29  EVENT_DISTANCE_CHANGED = 0,
30  };
31 
32  public:
37  distance( int32_t index );
38  ~distance();
39 
40  bool installed();
41  int32_t value();
42 
43 
49  double objectDistance( distanceUnits units );
50 
55  sizeType objectSize( void );
56 
61  int32_t objectRawSize( void );
62 
67  double objectVelocity( void );
68 
73  bool isObjectDetected( void );
74 
79  void changed( void (* callback)(void) );
80 
81  };
82 };
83 
84 #endif // VEX_DISTANCE_CLASS_H
vex::distanceUnits
distanceUnits
The measurement units for distance values.
Definition: vex_units.h:96
vex::distance::objectVelocity
double objectVelocity(void)
Gets an estimate of the detected object velocity.
vex::device
Use the device class to get information about a vex device plugged into the V5.
Definition: vex_device.h:30
vex::distance::distance
distance(int32_t index)
Creates a new distance sensor object on the port specified.
vex::sizeType
sizeType
The defined units for distance sensor object size.
Definition: vex_units.h:278
vex
device class
Definition: vex_brain.h:26
vex::distance::objectSize
sizeType objectSize(void)
Gets an estimate of the detected object size.
vex::distance
Use the distance class to control the distance sensor.
Definition: vex_distance.h:26
vex::distance::objectDistance
double objectDistance(distanceUnits units)
Gets the detected object distance.
vex::distance::objectRawSize
int32_t objectRawSize(void)
Gets an estimate of the detected object size.
vex::distance::changed
void changed(void(*callback)(void))
Calls a function when the distance value changes.
vex::distance::isObjectDetected
bool isObjectDetected(void)
check for object in range of the distance sensor