! Class for managing connection and state to a VL6180X sensor
More...
#include <Adafruit_VL6180X.h>
! Class for managing connection and state to a VL6180X sensor
◆ Adafruit_VL6180X()
Instantiates a new VL6180X class.
- Parameters
-
i2caddr | Optional initial i2c address of the chip, VL6180X_DEFAULT_I2C_ADDR is used by default |
◆ begin()
boolean Adafruit_VL6180X::begin |
( |
TwoWire * |
theWire = &Wire | ) |
|
Initializes I2C interface, checks that VL6180X is found and resets chip.
- Parameters
-
theWire | Optional pointer to I2C interface, &Wire is used by default |
- Returns
- True if chip found and initialized, False otherwise
◆ setAddress()
boolean Adafruit_VL6180X::setAddress |
( |
uint8_t |
newAddr | ) |
|
Sets the address of the device to a different address. chip.
- Parameters
-
newAddr | new I2C address for the device. |
- Returns
- True if write succeeded.
◆ getAddress()
uint8_t Adafruit_VL6180X::getAddress |
( |
void |
| ) |
|
gets the address of the device chip.
- Returns
- the address
◆ readRange()
uint8_t Adafruit_VL6180X::readRange |
( |
void |
| ) |
|
Single shot ranging. Be sure to check the return of readRangeStatus to before using the return value!
- Returns
- Distance in millimeters if valid
◆ readLux()
float Adafruit_VL6180X::readLux |
( |
uint8_t |
gain | ) |
|
Single shot lux measurement.
- Parameters
-
gain | Gain setting, one of VL6180X_ALS_GAIN_* |
- Returns
- Lux reading
◆ readRangeStatus()
uint8_t Adafruit_VL6180X::readRangeStatus |
( |
void |
| ) |
|
Request ranging success/error message (retreive after ranging)
- Returns
- One of possible VL6180X_ERROR_* values
◆ startRange()
boolean Adafruit_VL6180X::startRange |
( |
void |
| ) |
|
start Single shot ranging. The caller of this should have code that waits until the read completes, by either calling waitRangeComplete or calling isRangeComplete until it returns true. And then the code should call readRangeResult to retrieve the range value and clear out the internal status.
- Returns
- true if range completed.
◆ isRangeComplete()
boolean Adafruit_VL6180X::isRangeComplete |
( |
void |
| ) |
|
Check to see if the range command completed.
- Returns
- true if range completed.
◆ waitRangeComplete()
boolean Adafruit_VL6180X::waitRangeComplete |
( |
void |
| ) |
|
Wait until Range completed.
- Returns
- true if range completed.
◆ readRangeResult()
uint8_t Adafruit_VL6180X::readRangeResult |
( |
void |
| ) |
|
Return results of read reqyest also clears out the interrupt Be sure to check the return of readRangeStatus to before using the return value!
- Returns
- if range started.
◆ startRangeContinuous()
void Adafruit_VL6180X::startRangeContinuous |
( |
uint16_t |
period_ms = 50 | ) |
|
Start continuous ranging.
- Parameters
-
period_ms | Optional Period between ranges in ms. Values will be rounded down to 10ms units with minimum of 10ms. Default is 50 |
◆ setOffset()
void Adafruit_VL6180X::setOffset |
( |
uint8_t |
offset | ) |
|
Set the offset.
- Parameters
-
◆ getID()
void Adafruit_VL6180X::getID |
( |
uint8_t * |
id_ptr | ) |
|
Get the 7 bytes of id.
- Parameters
-
id_ptr | Pointer to array of id bytes |
The documentation for this class was generated from the following files: