semvec/pypi-packages huggingface dataset:
VL53L1X2 0.1.5
vl53l1x distance sensor driver for Raspberry Pi

# vl53l1x-python

Revised Python library for the VL53L1X Laser Ranger.

# Installing

```
sudo pip3 install smbus2
sudo pip3 install VL53L1X2
```

# Usage

```python
import VL53L1X

tof = VL53L1X.VL53L1X(i2c_bus=1, i2c_address=0x29)
tof.open() # Initialise the i2c bus and configure the sensor
tof.start_ranging(1) # Start ranging, 1 = Short Range, 2 = Medium Range, 3 = Long Range
distance_in_mm = tof.get_distance() # Grab the range in mm
tof.stop_ranging() # Stop ranging
```

See examples and tests for more advanced usage.


0.1.2
-----

* @josemotta ported it to python 3.6 as part of a homeassistant component.

Please see basic sample:

from homeassistant.const import TEMP_CELSIUS
from homeassistant.helpers.entity import Entity

REQUIREMENTS = ['smbus2==0.2.2', 'VL53L1X2==0.1.2']

def setup_platform(hass, config, add_devices, discovery_info=None):
    """Setup the sensor platform."""
    add_devices([TofSensor()])


class TofSensor(Entity):
    """Representation of a Sensor."""

    def __init__(self):
        """Initialize the sensor."""
        self._state = None

    @property
    def name(self):
        """Return the name of the sensor."""
        return 'VL53L1X'

    @property
    def state(self):
        """Return the state of the sensor."""
        return self._state

    @property
    def unit_of_measurement(self):
        """Return the unit of measurement."""
        return TEMP_CELSIUS

    def update(self):
        """Fetch new state data for the sensor.

        This is the only method that should fetch new data for Home Assistant.
        """
        self._state = 23

0.0.3
-----

* @NagyAttila upgrade focusing on working with more than 1 range sensors, also changed quit a lot to make it bit more robust.

0.0.2
-----

* Improved search for .so file to pick up arch-specific files.

0.0.1
-----

* Initial release.