Dist-Nx  1.2
An Arduino library to use DIST-Nx Mindsensors sensor
Public Member Functions
DistNx Class Reference

#include <DistNx.h>

Public Member Functions

 DistNx ()
 
 DistNx (const uint8_t address)
 
void switchOn ()
 
void switchOff ()
 
void disableAdpa ()
 
void enableAdpa ()
 
void setAddress (const uint8_t new_address)
 
String softwareVersion ()
 
String vendorId ()
 
String deviceId ()
 
int longDistance (void)
 
int mediumDistance (void)
 
int longVoltage (void)
 
int mediumVoltage (void)
 

Detailed Description

DIST-Nx class to encapsulate sensor behavior

Definition at line 70 of file DistNx.h.

Constructor & Destructor Documentation

DistNx::DistNx ( )

Create a new sensor object with the dafult I2C address (0x1).

Definition at line 52 of file DistNx.cpp.

DistNx::DistNx ( const uint8_t  address)

Use a new distance sensor with a custom I2C address.

Parameters
addresscustom I2C address for the new sensor.

Definition at line 58 of file DistNx.cpp.

Member Function Documentation

String DistNx::deviceId ( )

Get device ID.

Returns
Device ID in a String.

Definition at line 148 of file DistNx.cpp.

void DistNx::disableAdpa ( )

Disable ADPA mode

Definition at line 81 of file DistNx.cpp.

void DistNx::enableAdpa ( )

Enable ADPA mode

Definition at line 89 of file DistNx.cpp.

int DistNx::longDistance ( void  )

Get long distance from DIST-Nx.

Longue distance values from 30 to 140 cm with highest precision in zone 40 cm to 90 cm for V2 and 30 cm to 100 cm for V3.

Returns
Long distance in millimeters

Definition at line 167 of file DistNx.cpp.

int DistNx::longVoltage ( void  )
inline

Get long distance voltage from DIST-Nx.

Returns
Voltage for long distance in millivolts.

Definition at line 155 of file DistNx.h.

int DistNx::mediumDistance ( void  )

Get medium distance from DIST-Nx.

Medium distance values from 10 to 80 cm with highest precision in zone 10 cm to 40 cm for V2 and 10 cm to 40 cm for V3.

Returns
Medium distance in millimeters

Definition at line 182 of file DistNx.cpp.

int DistNx::mediumVoltage ( void  )

Get medium distance voltage from DIST-Nx.

Returns
Voltage for medium distance in millivolts.

Definition at line 206 of file DistNx.cpp.

void DistNx::setAddress ( const uint8_t  new_address)

Set a custom I2C address for the sensor.

Be careful ! This new address is effective immediately. Please note down your address carefully for future reference. I2C addresses are 7 bits long. So you can set addresses from 0x1 (1) to 0x7F (7). 0x0 is reserved to I2C master (the Arduino ).

Parameters
new_addressThe new I2C address for the sensor.

Definition at line 103 of file DistNx.cpp.

String DistNx::softwareVersion ( )

Get software version.

Returns
Software version in a String.

Definition at line 120 of file DistNx.cpp.

void DistNx::switchOff ( )

Switch off DIST-Nx sensor.

Definition at line 73 of file DistNx.cpp.

void DistNx::switchOn ( )

Switch on DIST-Nx sensor (by default, the sensor is on).

You should wait 40ms after that.

Definition at line 65 of file DistNx.cpp.

String DistNx::vendorId ( )

Get Vendor ID.

Returns
Vendor ID in a String.

Definition at line 134 of file DistNx.cpp.


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