Generic distance measurement

Browse source code on GitHub

Overview

This sample application periodically measures the distance of an object and display it, via the console.

Building and Running

This sample supports up to 5 distance sensors. Each sensor needs to be aliased as distanceN where N goes from 0 to 4. For example:

/ {
        aliases {
                distance0 = &vl53l1x;
        };
};

Make sure the aliases are in devicetree, then build and run with:

west build -b <board to use> samples/sensor/distance_polling
west flash

Sample Output

vl53l1x: 0.153m
vl53l1x: 0.154m
vl53l1x: 0.154m
vl53l1x: 0.153m

See also

Sensor Interface