adafruit_vl6180x¶
CircuitPython module for the VL6180X distance sensor. See examples/simpletest.py for a demo of the usage.
Author(s): Tony DiCola, Jonas Schatz
Implementation Notes¶
Hardware:
Adafruit VL6180X Time of Flight Distance Ranging Sensor (VL6180) (Product ID: 3316)
Software and Dependencies:
Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_vl6180x.VL6180X(i2c: busio.I2C, address: int = 41, offset: int = 0)[source]¶
Create an instance of the VL6180X distance sensor. You must pass in the following parameters:
- Parameters
i2c (~I2C) – An instance of the I2C bus connected to the sensor.
Optionally you can specify:
- Parameters
- property range_from_history: Optional[int]¶
Read the latest range data from history To do so, you don’t have to wait for a complete measurement.
- property range_status: int¶
Retrieve the status/error from a previous range read. This will return a constant value such as:
Error
Description
ERROR_NONENo error
ERROR_SYSERR_1System error 1 (see datasheet)
ERROR_SYSERR_5System error 5 (see datasheet)
ERROR_ECEFAILECE failure
ERROR_NOCONVERGENo convergence
ERROR_RANGEIGNOREOutside range ignored
ERROR_SNRToo much noise
ERROR_RAWUFLOWRaw value underflow
ERROR_RAWOFLOWRaw value overflow
ERROR_RANGEUFLOWRange underflow
ERROR_RANGEOFLOWRange overflow
- read_lux(gain: int) float[source]¶
Read the lux (light value) from the sensor and return it. Must specify the gain value to use for the lux reading:
Setting
Value
ALS_GAIN_11x
ALS_GAIN_1_251.25x
ALS_GAIN_1_671.67x
ALS_GAIN_2_52.5x
ALS_GAIN_55x
ALS_GAIN_1010x
ALS_GAIN_2020x
ALS_GAIN_4040x
- Parameters
gain (int) – The gain value to use