README.rst
1.. zephyr:code-sample:: lsmd6dsl
2 :name: LSM6DSL IMU sensor
3 :relevant-api: sensor_interface
4
5 Get accelerometer and gyroscope data from an LSM6DSL sensor (polling & trigger
6 mode).
7
8Overview
9********
10
11This sample sets the LSM6DSL accelerometer and gyroscope to 104Hz
12and enable a trigger on data ready. It displays on the console the
13values for accelerometer and gyroscope, plus optionally the values of
14any magnetometer or pressure sensor attached to it (sensorhub function).
15
16
17Requirements
18************
19
20This sample uses the LSM6DSL sensor controlled using the I2C or SPI interface.
21It has been tested on both :ref:`96b_argonkey` and disco_l475_iot1 board.
22
23References
24**********
25
26- LSM6DSL https://www.st.com/en/mems-and-sensors/lsm6dsl.html
27
28Building and Running
29********************
30
31 This project outputs sensor data to the console. It requires an LSM6DSL
32 sensor, which is present on both the :ref:`96b_argonkey` and disco_l475_iot1 board.
33
34Building on ArgonKey board
35==========================
36
37.. zephyr-app-commands::
38 :zephyr-app: samples/sensor/lsm6dsl
39 :host-os: unix
40 :board: 96b_argonkey
41 :goals: build
42 :compact:
43
44Building on disco_l475_iot1 board
45=================================
46
47.. zephyr-app-commands::
48 :zephyr-app: samples/sensor/lsm6dsl
49 :host-os: unix
50 :board: disco_l475_iot1
51 :goals: build
52 :compact:
53
54Building on nrf52840dk/nrf52840 board with x-nucleo-iks01a2 shield
55==================================================================
56
57.. zephyr-app-commands::
58 :zephyr-app: samples/sensor/lsm6dsl
59 :host-os: unix
60 :board: nrf52840dk/nrf52840
61 :shield: x_nucleo_iks01a2
62 :goals: build
63 :compact:
64
65Sample Output
66=============
67
68.. code-block:: console
69
70 LSM6DSL sensor samples:
71
72 accel (-3.184000 -0.697000 9.207000) m/s2
73 gyro (0.065000 -0.029000 0.002000) dps
74 magn (-0.042000 0.294000 -0.408000) gauss
75 - (0) (trig_cnt: 190474)
76
77 <repeats endlessly every 2 seconds>
78
79.. note:: The magn row is displayed only when running sample onto 96b_argonkey board, where a magnetometer is connected to LSM6DSL.
80