VL53L0X: Time Of Flight sensor


This sample periodically measures distance between vl53l0x sensor and target. The result is displayed on the console. It also shows how we can use the vl53l0x as a proximity sensor.


This sample uses the VL53L0X sensor controlled using the I2C interface.

Building and Running

This project outputs sensor data to the console. It requires a VL53L0X sensor, which is present on the disco_l475_iot1 board.

Using west:

west build -b None samples/sensor/vl53l0x/
west flash

Using CMake and ninja:

# Use cmake to configure a Ninja-based buildsystem:
cmake -B build -GNinja samples/sensor/vl53l0x/

# Now run ninja on the generated build system:
ninja -C build
ninja -C build flash

Sample Output

prox is 0
distance is 1938
prox is 1
distance is 70
prox is 0
distance is 1995

<repeats endlessly every second>