Introduction

Documentation Status Discord

CircuitPython module for the VL6180X distance sensor. See examples/simpletest.py for a demo of the usage.

Dependencies

This driver depends on:

Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.

Usage Example

See examples/simpletest.py for a demo of the usage.

API Reference

Adafruit_VL6180X

CircuitPython module for the VL6180X distance sensor. See examples/simpletest.py for a demo of the usage.

  • Author(s): Tony DiCola
class adafruit_vl6180x.VL6180X(i2c, address=<sphinx.ext.autodoc._MockObject object>)[source]

Create an instance of the VL6180X distance sensor. You must pass in the following parameters: - i2c: An instance of the I2C bus connected to the sensor.

Optionally you can specify: - address: The I2C address of the sensor. If not specified the sensor’s

default value will be assumed.
range

Read the range of an object in front of sensor and return it in mm.

range_status

Retrieve the status/error from a previous range read. This will return a constant value such as: - ERROR_NONE - No error - ERROR_SYSERR_1 - System error 1 (see datasheet) - ERROR_SYSERR_5 - System error 5 (see datasheet) - ERROR_ECEFAIL - ECE failure - ERROR_NOCONVERGE - No convergence - ERROR_RANGEIGNORE - Outside range ignored - ERROR_SNR - Too much noise - ERROR_RAWUFLOW - Raw value underflow - ERROR_RAWOFLOW - Raw value overflow - ERROR_RANGEUFLOW - Range underflow - ERROR_RANGEOFLOW - Range overflow

read_lux(gain)[source]

Read the lux (light value) from the sensor and return it. Must specify the gain value to use for the lux reading: - ALS_GAIN_1 = 1x - ALS_GAIN_1_25 = 1.25x - ALS_GAIN_1_67 = 1.67x - ALS_GAIN_2_5 = 2.5x - ALS_GAIN_5 = 5x - ALS_GAIN_10 = 10x - ALS_GAIN_20 = 20x - ALS_GAIN_40 = 40x

Contributing

Contributions are welcome! Please read our Code of Conduct before contributing to help this project stay welcoming.

Building locally

To build this library locally you’ll need to install the circuitpython-build-tools package.

python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools

Once installed, make sure you are in the virtual environment:

source .env/bin/activate

Then run the build:

circuitpython-build-bundles --filename_prefix adafruit-circuitpython-vl6180x --library_location .