1.. zephyr:code-sample:: lis2dh
2   :name: LIS2DH Motion Sensor
3   :relevant-api: sensor_interface
4
5   Get accelerometer data from an LIS2DH sensor (polling & trigger mode).
6
7Overview
8********
9
10This sample application periodically reads accelerometer data from the
11LIS2DH sensor (or the compatible LS2DH12, LIS3DH, and LSM303DLHC
12sensors), and displays the sensor data on the console.
13
14Requirements
15************
16
17This sample uses the LIS2DH, ST MEMS system-in-package featuring a 3D
18digital output motion sensor.
19
20References
21**********
22
23For more information about the LIS2DH motion sensor see
24https://www.st.com/en/mems-and-sensors/lis2dh.html.
25
26Building and Running
27********************
28
29The LIS2DH2 or compatible sensors are available on a variety of boards
30and shields supported by Zephyr, including:
31
32* :zephyr:board:`actinius_icarus`
33* :ref:`thingy52_nrf52832`
34* :zephyr:board:`stm32f3_disco`
35* :ref:`x-nucleo-iks01a2`
36
37See the board documentation for detailed instructions on how to flash
38and get access to the console where acceleration data is displayed.
39
40Building on actinius_icarus
41===========================
42
43:zephyr:board:`actinius_icarus` includes an ST LIS2DH12 accelerometer which
44supports the LIS2DH interface.
45
46.. zephyr-app-commands::
47   :zephyr-app: samples/sensor/lis2dh
48   :board: actinius_icarus
49   :goals: build flash
50   :compact:
51
52Building on nucleo_l476rg with IKS01A2 shield
53=============================================
54
55The :ref:`x-nucleo-iks01a2` includes an LSM303AGR accelerometer which
56supports the LIS2DH interface.  This shield may also be used on other
57boards with Arduino headers.
58
59.. zephyr-app-commands::
60   :zephyr-app: samples/sensor/lis2dh
61   :board: nucleo_l476rg
62   :goals: build flash
63   :shield: x_nucleo_iks01a2
64   :compact:
65
66Sample Output
67=============
68
69.. code-block:: console
70
71    Polling at 0.5 Hz
72    #1 @ 12 ms: x -5.387328 , y 5.578368 , z -5.463744
73    #2 @ 2017 ms: x -5.310912 , y 5.654784 , z -5.501952
74    #3 @ 4022 ms: x -5.349120 , y 5.692992 , z -5.463744
75
76   <repeats endlessly every 2 seconds>
77