README.rst
1.. zephyr:code-sample:: lsmd303dlhc
2 :name: LSM303DLHC Magnetometer and Accelerometer sensor
3 :relevant-api: sensor_interface
4
5 Get magnetometer and accelerometer data from an LSM303DLHC sensor (polling
6 mode).
7
8Overview
9********
10This sample application periodically reads magnetometer and accelerometer data
11from the LSM303DLHC eCompass module's sensors, and displays the sensor data
12on the console.
13
14Requirements
15************
16
17This sample uses the LSM303DLHC, ST MEMS system-in-package featuring a
183D digital linear acceleration sensor and a 3D digital magnetic sensor,
19controlled using the I2C interface.
20
21References
22**********
23
24For more information about the LSM303DLHC eCompass module, see
25https://www.st.com/en/mems-and-sensors/lsm303dlhc.html
26
27Building and Running
28********************
29
30This project outputs sensor data to the console. It requires a LSM303DLHC
31system-in-package, which is present on the stm32f3_disco board
32
33.. zephyr-app-commands::
34 :zephyr-app: samples/sensor/lsm303dlhc
35 :board: stm32f3_disco
36 :goals: build
37 :compact:
38
39Sample Output
40=============
41
42.. code-block:: console
43
44 Magnetometer data:
45 ( x y z ) = ( 0.531818 -0.435454 -0.089090 )
46 Accelerometer data:
47 ( x y z ) = ( -0.078127 -0.347666 1.105502 )
48 Magnetometer data:
49 ( x y z ) = ( -0.003636 0.297272 -0.255454 )
50 Accelerometer data:
51 ( x y z ) = ( 0.074221 -0.304696 0.972685 )
52
53 <repeats endlessly every 2 seconds>
54