Dist-Nx
1.2
An Arduino library to use DIST-Nx Mindsensors sensor
|
#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) |
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.
address | custom I2C address for the new sensor. |
Definition at line 58 of file DistNx.cpp.
String DistNx::deviceId | ( | ) |
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.
Definition at line 167 of file DistNx.cpp.
|
inline |
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.
Definition at line 182 of file DistNx.cpp.
int DistNx::mediumVoltage | ( | void | ) |
Get medium distance voltage from DIST-Nx.
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 ).
new_address | The new I2C address for the sensor. |
Definition at line 103 of file DistNx.cpp.
String DistNx::softwareVersion | ( | ) |
Get software version.
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 | ( | ) |