1.. zephyr:code-sample:: distance_polling 2 :name: Generic distance measurement 3 :relevant-api: sensor_interface 4 5 Measure distance to an object using a distance sensor 6 7Overview 8******** 9 10This sample application periodically measures the distance of an object and 11display it, via the console. 12 13Building and Running 14******************** 15 16This sample supports up to 5 distance sensors. Each sensor needs to be aliased 17as ``distanceN`` where ``N`` goes from ``0`` to ``4``. For example: 18 19.. code-block:: devicetree 20 21 / { 22 aliases { 23 distance0 = &vl53l1x; 24 }; 25 }; 26 27Make sure the aliases are in devicetree, then build and run with: 28 29.. zephyr-app-commands:: 30 :zephyr-app: samples/sensor/distance_polling 31 :board: <board to use> 32 :goals: build flash 33 :compact: 34 35Sample Output 36============= 37 38.. code-block:: console 39 40 vl53l1x: 0.153m 41 vl53l1x: 0.154m 42 vl53l1x: 0.154m 43 vl53l1x: 0.153m 44