Qwiic_VL53L1X_Py¶
Python module for the SparkFun Distance Sensor Breakout - 4 Meter, VL53L1X (Qwiic).
This package should be used in conjunction with the overall SparkFun qwiic Python Package. New to qwiic? Take a look at the entire SparkFun qwiic ecosystem.
Contents¶
Supported Platforms¶
The qwiic VL53L1X Python package current supports the following platforms:
Raspberry Pi <!– Platforms to be tested
Dependencies¶
This package depends on the qwiic I2C driver: Qwiic_I2C_Py
Documentation¶
The SparkFun qwiic VL53L1X module documentation is hosted at ReadTheDocs
Installation¶
PyPi Installation¶
This repository is hosted on PyPi as the sparkfun-qwiic-vl53l1x package. On systems that support PyPi installation via pip, this library is installed using the following commands
For all users (note: the user must have sudo privileges):
sudo pip install sparkfun-qwiic-vl53l1x
For the current user:
pip install sparkfun-qwiic-vl53l1x
Local Installation¶
To install, make sure the setuptools package is installed on the system.
Direct installation at the command line:
python setup.py install
To build a package for use with pip:
python setup.py sdist
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
cd dist
pip install sparkfun_qwiic_vl53l1x-<version>.tar.gz
Example Use¶
See the examples directory for more detailed use examples.
import qwiic_vl53l1x
import time
import sys
def runExample():
print("\nSparkFun VL53L1X Example 1\n")
mySensor = qwiic_vl53l1x.QwiicVL53L1X()
if mySensor.isConnected() == False:
print("The Qwiic VL53L1X device isn't connected to the system. Please check your connection", \
file=sys.stderr)
return
mySensor.sensor_init()
while True:
try:
mySensor.start_ranging() # Write configuration bytes to initiate measurement
time.sleep(.005)
distance = mySensor.get_distance() # Get the result of the measurement from the sensor
time.sleep(.005)
mySensor.stop_ranging()
print("Distance(mm): %s" % distance)
except Exception as e:
print(e)
Table of Contents¶
- API Reference
QwiicVL53L1X
QwiicVL53L1X.boot_state()
QwiicVL53L1X.calibrate_offset()
QwiicVL53L1X.calibrate_xtalk()
QwiicVL53L1X.check_for_data_ready()
QwiicVL53L1X.clear_interrupt()
QwiicVL53L1X.get_ambient_per_spad()
QwiicVL53L1X.get_ambient_rate()
QwiicVL53L1X.get_distance()
QwiicVL53L1X.get_distance_mode()
QwiicVL53L1X.get_distance_threshold_high()
QwiicVL53L1X.get_distance_threshold_low()
QwiicVL53L1X.get_distance_threshold_window()
QwiicVL53L1X.get_inter_measurement_in_ms()
QwiicVL53L1X.get_interrupt_polarity()
QwiicVL53L1X.get_offset()
QwiicVL53L1X.get_range_status()
QwiicVL53L1X.get_roi_xy()
QwiicVL53L1X.get_sensor_id()
QwiicVL53L1X.get_sigma_threshold()
QwiicVL53L1X.get_signal_per_spad()
QwiicVL53L1X.get_signal_rate()
QwiicVL53L1X.get_signal_threshold()
QwiicVL53L1X.get_spad_nb()
QwiicVL53L1X.get_sw_version()
QwiicVL53L1X.get_timing_budget_in_ms()
QwiicVL53L1X.get_xtalk()
QwiicVL53L1X.init_sensor()
QwiicVL53L1X.sensor_init()
QwiicVL53L1X.set_distance_mode()
QwiicVL53L1X.set_distance_threshold()
QwiicVL53L1X.set_i2c_address()
QwiicVL53L1X.set_inter_measurement_in_ms()
QwiicVL53L1X.set_interrupt_polarity()
QwiicVL53L1X.set_offset()
QwiicVL53L1X.set_roi()
QwiicVL53L1X.set_sigma_threshold()
QwiicVL53L1X.set_signal_threshold()
QwiicVL53L1X.set_timing_budget_in_ms()
QwiicVL53L1X.set_xtalk()
QwiicVL53L1X.start_ranging()
QwiicVL53L1X.start_temperature_update()
QwiicVL53L1X.stop_ranging()