1.. zephyr:Code-sample:: magn-trig
2 :name: Magnetometer trigger
3
4 Test and debug magnetometer with interrupts
5
6Overview
7********
8
9Sample application that reads magnetometer (X, Y, Z) data from
10the available device that implements SENSOR_TRIG_DATA_READY and SENSOR_CHAN_MAGN_*.
11
12Building and Running
13********************
14
15.. code-block:: devicetree
16
17 / {
18 aliases {
19 magn0 = &fxos8700;
20 };
21 };
22
23Make sure the aliases are in devicetree, then build and run with:
24
25.. zephyr-app-commands::
26 :zephyr-app: samples/sensor/magn_trig
27 :board: <board to use>
28 :goals: build flash
29 :compact:
30
31Sample Output
32=============
33
34.. code-block:: console
35
36 fxos8700@1d (x, y, z): ( -0.107000, 0.118000, -1.026000)
37 fxos8700@1d (x, y, z): ( -0.132000, 0.083000, -0.981000)
38 fxos8700@1d (x, y, z): ( -0.143000, 0.102000, -0.931000)
39 fxos8700@1d (x, y, z): ( -0.153000, 0.126000, -0.843000)
40 fxos8700@1d (x, y, z): ( -0.145000, 0.152000, -0.802000)
41 fxos8700@1d (x, y, z): ( -0.143000, 0.125000, -0.740000)
42 fxos8700@1d (x, y, z): ( -0.133000, 0.130000, -0.736000)
43 fxos8700@1d (x, y, z): ( -0.133000, 0.124000, -0.776000)
44 fxos8700@1d (x, y, z): ( -0.120000, 0.123000, -0.776000)
45 fxos8700@1d (x, y, z): ( -0.135000, 0.120000, -0.782000)
46 fxos8700@1d (x, y, z): ( -0.129000, 0.116000, -0.787000)
47