zephyr/samples/sensor/dht_polling
Ian Morris dfc747d53a samples: sensor: dht_polling: Add generic dht sample application
This simple application periodically prints the temperature and humidity
measured by one or more digital humidity/temperature sensors.

Signed-off-by: Ian Morris <ian.d.morris@outlook.com>
2023-11-17 10:33:02 -06:00
..
boards
src
CMakeLists.txt
README.rst
prj.conf
sample.yaml

README.rst

.. _dht_polling:

Generic Digital Humidity Temperature sensor polling sample
##########################################################

Overview
********

This sample application demonstrates how to use digital humidity temperature
sensors.

Building and Running
********************

This sample supports up to 10 humidity/temperature sensors. Each sensor needs to
be aliased as ``dhtN`` where ``N`` goes from ``0`` to ``9``. For example:

.. code-block:: devicetree

  / {
	aliases {
			dht0 = &hs300x;
		};
	};

Make sure the aliases are in devicetree, then build and run with:

.. zephyr-app-commands::
   :zephyr-app: samples/sensor/dht_polling
   :board: <board to use>
   :goals: build flash
   :compact:

Sample Output
=============

.. code-block:: console

       hs300x@44: temp is 25.31 °C humidity is 30.39 %RH
       hs300x@44: temp is 25.51 °C humidity is 30.44 %RH
       hs300x@44: temp is 25.51 °C humidity is 30.37 %RH
       hs300x@44: temp is 25.51 °C humidity is 30.39 %RH
       hs300x@44: temp is 25.31 °C humidity is 30.37 %RH
       hs300x@44: temp is 25.31 °C humidity is 30.35 %RH
       hs300x@44: temp is 25.51 °C humidity is 30.37 %RH
       hs300x@44: temp is 25.51 °C humidity is 30.37 %RH
       hs300x@44: temp is 25.51 °C humidity is 30.39 %RH
       hs300x@44: temp is 25.51 °C humidity is 30.44 %RH
       hs300x@44: temp is 25.51 °C humidity is 30.53 %RH