README.rst
1.. zephyr:code-sample:: dht_polling
2 :name: Generic digital humidity temperature sensor polling
3 :relevant-api: sensor_interface
4
5 Get temperature and humidity data from a DHT sensor (polling mode).
6
7Overview
8********
9
10This sample application demonstrates how to use digital humidity temperature
11sensors.
12
13Building and Running
14********************
15
16This sample supports up to 10 humidity/temperature sensors. Each sensor needs to
17be aliased as ``dhtN`` where ``N`` goes from ``0`` to ``9``. For example:
18
19.. code-block:: devicetree
20
21 / {
22 aliases {
23 dht0 = &hs300x;
24 };
25 };
26
27
28Make sure the aliases are in devicetree.
29
30It also requires a correct fixture setup when the sensor is present.
31For the correct execution of that sample in twister, add into boards's
32map-file next fixture settings::
33
34 - fixture: fixture_i2c_hs300x
35
36
37Then build and run with:
38
39.. zephyr-app-commands::
40 :zephyr-app: samples/sensor/dht_polling
41 :board: <board to use>
42 :goals: build flash
43 :compact:
44
45Sample Output
46=============
47
48.. code-block:: console
49
50 hs300x@44: temp is 25.31 °C humidity is 30.39 %RH
51 hs300x@44: temp is 25.51 °C humidity is 30.44 %RH
52 hs300x@44: temp is 25.51 °C humidity is 30.37 %RH
53 hs300x@44: temp is 25.51 °C humidity is 30.39 %RH
54 hs300x@44: temp is 25.31 °C humidity is 30.37 %RH
55 hs300x@44: temp is 25.31 °C humidity is 30.35 %RH
56 hs300x@44: temp is 25.51 °C humidity is 30.37 %RH
57 hs300x@44: temp is 25.51 °C humidity is 30.37 %RH
58 hs300x@44: temp is 25.51 °C humidity is 30.39 %RH
59 hs300x@44: temp is 25.51 °C humidity is 30.44 %RH
60 hs300x@44: temp is 25.51 °C humidity is 30.53 %RH
61