Use the distance class to control the distance sensor.  
 More...
#include <vex_distance.h>
 | 
|   | 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.  
  | 
|   | 
| 
  | device (int32_t index) | 
|   | 
| 
IQ_DeviceType  | type () | 
|   | 
| 
int32_t  | index () | 
|   | 
| 
void  | init (int32_t index) | 
|   | 
| 
int32_t  | readDigitalPin () | 
|   | 
| 
int32_t  | readAnalogPin () | 
|   | 
 | 
| 
void  | setPollInterval (int32_t value) | 
|   | 
| 
bool  | pollValid (bool bSave) | 
|   | 
| int16_t  | _index | 
|   | 
Use the distance class to control the distance sensor. 
Definition at line 26 of file vex_distance.h.
 
◆ distance()
      
        
          | vex::distance::distance  | 
          ( | 
          int32_t |           index | ) | 
           | 
        
      
 
Creates a new distance sensor object on the port specified. 
- Parameters
 - 
  
    | index | The port index for this sensor. The index is zero-based.  | 
  
   
 
 
◆ changed()
      
        
          | void vex::distance::changed  | 
          ( | 
          void(* |           callback )(void) | ) | 
           | 
        
      
 
Calls a function when the distance value changes. 
- Parameters
 - 
  
    | callback | A reference to a function.  | 
  
   
 
 
◆ installed()
  
  
      
        
          | bool vex::distance::installed  | 
          ( | 
           | ) | 
           | 
         
       
   | 
  
virtual   | 
  
 
 
◆ 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
 - 
  
    | units | The 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   | 
  
 
 
The documentation for this class was generated from the following file: