1.. zephyr:code-sample:: stwinbx1_sensors
2   :name: STWIN.box sensors
3
4   Read sensor data from the various STWIN SensorTile wireless industrial node sensors.
5
6Overview
7********
8This sample provides an example of how to read sensors data
9from the STWIN.box board.
10
11This sample enables all sensors of STWIN.box board, and then
12periodically reads and displays data on the console from the following
13sensors:
14
15- STTS22H: Digital temperature sensor
16- IIS2MDC: 3-axis magnetometer
17- ISM330DHCX: IMU, 3D accelerometer and 3D gyroscope with Machine Learning Core and Finite State Machine
18- IIS2DLPC: high-performance ultra-low-power 3-axis accelerometer for industrial applications
19- IIS2ICLX: high-accuracy, high-resolution, low-power, 2-axis digital inclinometer with Machine Learning Core
20- ILPS22QS: ultra-compact piezoresistive absolute pressure sensor
21
22Requirements
23************
24
25The application requires a STWIN.box board connected to the PC
26through USB. The board shows up as a USB CDC class standard device.
27
28References
29**********
30
31- :zephyr:board:`steval_stwinbx1`
32
33Building and Running
34********************
35
36Build and flash the sample in the following way:
37
38.. zephyr-app-commands::
39    :zephyr-app: samples/boards/st/steval_stwinbx1/sensors
40    :board: steval_stwinbx1
41    :goals: build flash
42
43Please note that flashing the board requires a few preliminary steps described
44in :zephyr:board:`steval_stwinbx1`.
45
46Then, power cycle the board by disconnecting and reconnecting the USB cable.
47Run your favorite terminal program to listen for output.
48
49.. code-block:: console
50
51   $ minicom -D <tty_device> -b 115200
52
53Replace :code:`<tty_device>` with the correct device path automatically created on
54the host after the STWIN.box board gets connected to it,
55usually :code:`/dev/ttyUSBx` or :code:`/dev/ttyACMx` (with x being 0, 1, 2, ...).
56The ``-b`` option sets baud rate ignoring the value from config.
57
58Sample Output
59=============
60
61The sample code outputs sensors data on the STWIN.box console.
62
63 .. code-block:: console
64
65    STWIN.box dashboard
66
67    STTS22H: Temperature: 24.4 C
68    IIS2DLPC: Accel (m.s-2): x: -5.590, y: -0.536, z: 8.040
69    IIS2MDC: Magn (gauss): x: 0.420, y: -0.116, z: -0.103
70    IIS2MDC: Temperature: 21.0 C
71    ISM330DHCX: Accel (m.s-2): x: 0.000, y: 5.704, z: 7.982
72    ISM330DHCX: Gyro (dps): x: 0.026, y: -0.006, z: -0.008
73    IIS2ICLX: Accel (m.s-2): x: -0.157, y: 5.699
74    ILPS22QS: Temperature: 26.4 C
75    ILPS22QS: Pressure: 100.539 kpa
76    1:: iis2dlpc trig 2021
77    1:: iis2mdc trig 993
78    1:: ism330dhcx acc trig 4447
79    1:: ism330dhcx gyr trig 2223
80    1:: iis2iclx trig 2091
81
82    <repeats endlessly every 2s>
83