README.rst
1.. zephyr:code-sample:: light_sensor_polling
2 :name: Generic Light Sensor Polling
3 :relevant-api: sensor_interface
4
5 Get illuminance data from a light sensor.
6
7Overview
8********
9
10This sample application gets the output of the light sensor and prints it to the console, in
11units of lux, once every second.
12
13Requirements
14************
15
16To use this sample, the following hardware is required:
17
18* A board with ADC support
19* A supported light sensor (e.g., `Grove Light Sensor`_), available as ``light-sensor`` Devicetree alias.
20
21Wiring
22******
23
24The wiring depends on the specific light sensor and board being used. Provide a devicetree
25overlay that specifies the sensor configuration for your setup.
26
27Building and Running
28********************
29
30Build and flash the sample as follows, changing ``nrf52dk/nrf52832`` to your board:
31
32.. zephyr-app-commands::
33 :zephyr-app: samples/sensor/light_polling
34 :board: nrf52dk/nrf52832
35 :goals: build flash
36 :compact:
37
38Sample Output
39=============
40
41.. code-block:: console
42
43 *** Booting Zephyr OS build v3.6.0-rc1-32-gba639ed6a893 ***
44 lux: 0.945751
45 lux: 0.882292
46 lux: 0.755973
47
48.. _Grove Light Sensor: https://wiki.seeedstudio.com/Grove-Light_Sensor/
49