1.. _vcnl4040_sample:
2
3VCNL4040: proximity and ambient light sensor
4############################################
5
6Overview
7********
8 This sample periodically measures proximity and light for
9 5 sec in the interval of 300msec in polling mode. Then threshold trigger mode
10 is enabled with the high threshold value of 127 and data is fetched based
11 on interrupt. The result is displayed on the console.
12
13Requirements
14************
15
16 This sample uses the VCNL4040 sensor controlled using the I2C interface.
17 Connect sensor INT for interrupt to Feather D5 pin on the Adafruit STM32F405 Feather.
18
19References
20**********
21
22 - VCNL4040: https://www.vishay.com/docs/84274/vcnl4040.pdf
23
24Building and Running
25********************
26
27 This project outputs sensor data to the console. It requires a VCNL4040
28 sensor to be connected to the desired board.
29
30 .. zephyr-app-commands::
31    :app: samples/sensor/vcnl4040/
32    :goals: build flash
33
34
35Sample Output
36=============
37
38 .. code-block:: console
39
40    get device vcnl4040
41    Testing the polling mode.
42    Proximity: 31
43    Light (lux): 288
44
45    <repeats for 5sec every 300ms>
46
47    Polling mode test finished.
48    Testing the trigger mode.
49    Testing proximity trigger.
50    ...
51    Triggered.
52    Proximity: 122
53
54    <repeats whenever triggered for 5sec>
55
56    Threshold trigger test finished.
57    Trigger mode test finished.
58