VEX V5 C++ API
Public Member Functions | List of all members
vex::sonar Class Reference

Use this class when programming with a sonar sensor. More...

Inherits vex::__tridevice.

Public Member Functions

 sonar (triport::port &port)
 Creates a new sonar object on the port specified in the parameter. More...
 
 ~sonar ()
 
int32_t value ()
 Gets the value of the distance sensor. More...
 
 operator int ()
 
double distance (distanceUnits units)
 Gets the value of the distance sensor. More...
 

Detailed Description

Use this class when programming with a sonar sensor.

Constructor & Destructor Documentation

◆ sonar()

vex::sonar::sonar ( triport::port port)

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

Parameters
portA reference to a three wire port.

◆ ~sonar()

vex::sonar::~sonar ( )

Member Function Documentation

◆ value()

int32_t vex::sonar::value ( )

Gets the value of the distance sensor.

Returns
Returns an integer that represents the value of the sonar sensor.

◆ operator int()

vex::sonar::operator int ( )

◆ distance()

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

Gets the value of the distance sensor.

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