upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
Public Member Functions | Protected Attributes
MB704X Class Reference

API for the MB704x MaxSonar-WR Ultrasonic Ranger. More...

Detailed Description

This driver was tested with the MB704x MaxSonar-WR Ultrasonic Ranger using the long distance, weather resistant horn. Depending on your sensor type and horn, tanges from 20cm to 750cm are possible.

// Instantiate a MB704X sensor using default parameters (bus 0,
// address 112)
upm::MB704X sensor;
while (shouldRun) {
cout << "Range: " << sensor.getRange() << " cm" << endl;
upm_delay_ms(500);
}
cout << "Exiting..." << endl;

Public Member Functions

 MB704X (unsigned int bus=0, unsigned int addr=112)
 
 ~MB704X ()
 
int getRange ()
 

Protected Attributes

mb704x_context m_mb704x
 

Constructor & Destructor Documentation

MB704X ( unsigned int  bus = 0,
unsigned int  addr = 112 
)

Initialize a device context.

Parameters
busSpecify which the I2C bus to use. The default is 0.
addrSpecify the I2C address to use. The default is 112.
~MB704X ( )

MB704X object destructor

Here is the call graph for this function:

Member Function Documentation

int getRange ( )

Query the device for a range reading. The range will be reported in centimeters (cm).

Parameters
devDevice context
Returns
Measured range, -1 on error. The range is reported in centimeters (cm).

Here is the call graph for this function:

Collaboration diagram for MB704X:
Collaboration graph
[legend]

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