2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
[![Arduino CI](https://github.com/RobTillaart/DHT2pin/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)
|
2021-12-16 07:42:53 -05:00
|
|
|
[![Arduino-lint](https://github.com/RobTillaart/DHT2pin/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/DHT2pin/actions/workflows/arduino-lint.yml)
|
|
|
|
[![JSON check](https://github.com/RobTillaart/DHT2pin/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/DHT2pin/actions/workflows/jsoncheck.yml)
|
2023-10-24 10:30:56 -04:00
|
|
|
[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/DHT2pin.svg)](https://github.com/RobTillaart/DHT2pin/issues)
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/DHT2pin/blob/master/LICENSE)
|
|
|
|
[![GitHub release](https://img.shields.io/github/release/RobTillaart/DHT2pin.svg?maxAge=3600)](https://github.com/RobTillaart/DHT2pin/releases)
|
2023-10-24 10:30:56 -04:00
|
|
|
[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/DHT2pin.svg)](https://registry.platformio.org/libraries/robtillaart/DHT2pin)
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
# DHT2pin
|
2016-12-17 15:03:32 -05:00
|
|
|
|
2021-12-16 07:42:53 -05:00
|
|
|
Arduino library for experimental 2 pin DHT library.
|
|
|
|
|
2017-07-27 09:51:10 -04:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
## Credits & testing
|
|
|
|
|
|
|
|
Maria Emanuella Moura Silva for testing and verifying this experimental
|
|
|
|
code on a Galileo.
|
|
|
|
|
|
|
|
|
2017-07-27 09:51:10 -04:00
|
|
|
## Description
|
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
**NOTE: THIS LIB IS NOT TESTED EXTENSIVELY YET SO USE WITH CARE**
|
2016-12-17 15:03:32 -05:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
This library is an **experimental** version of the DHT library that uses **two** data pins.
|
|
|
|
One pin for all read actions and one pin for all write actions.
|
|
|
|
This way one does not need to switch a pin between **INPUT** and **OUTPUT**.
|
2020-11-27 05:10:47 -05:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
Note:
|
|
|
|
It needs a diode between the input pin of the MCU and the data pin of the DHT sensor.
|
|
|
|
The output pin of the MCU is directly connected to the data pin of the DHT sensor.
|
2016-12-17 15:03:32 -05:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
This library was made after a request which also referred to the links below.
|
2016-12-17 15:03:32 -05:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
https://web.archive.org/web/20150912065850/https://communities.intel.com/thread/53869
|
2016-12-17 15:03:32 -05:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
https://web.archive.org/web/20180510215445/http://bigdinotech.com/tutorials/galileo-tutorials/using-1-wire-device-with-intel-galileo
|
|
|
|
(there might be later versions)
|
2017-07-27 09:51:10 -04:00
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
**NOTE: THIS LIB IS NOT TESTED EXTENSIVELY YET SO USE WITH CARE**
|
|
|
|
|
2021-12-16 07:42:53 -05:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
## interface
|
2020-11-27 05:10:47 -05:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
```cpp
|
|
|
|
#include "DHT2pin.h"
|
|
|
|
```
|
|
|
|
|
|
|
|
- **DHT2pin(uint8_t rpin, uint8_t wpin)** constructor.
|
|
|
|
- **void begin()** set pinModes correctly, must be called before read().
|
|
|
|
- **int read11()** read a DHT11.
|
|
|
|
- **int read()** read a DHT22 and equivalents.
|
|
|
|
- **float humidity()** get last humidity read.
|
|
|
|
- **float temperature()** get last temperature read.
|
2017-07-27 09:51:10 -04:00
|
|
|
|
2021-12-16 07:42:53 -05:00
|
|
|
|
2020-11-27 05:10:47 -05:00
|
|
|
## Operation
|
2017-07-27 09:51:10 -04:00
|
|
|
|
2023-01-29 14:16:17 -05:00
|
|
|
See example
|
2016-12-17 15:03:32 -05:00
|
|
|
|
2021-12-16 07:42:53 -05:00
|
|
|
|
|
|
|
## Future
|
|
|
|
|
|
|
|
- no active development planned
|
2023-01-29 14:16:17 -05:00
|
|
|
|
2023-10-24 10:30:56 -04:00
|
|
|
|
|
|
|
## Support
|
|
|
|
|
|
|
|
If you appreciate my libraries, you can support the development and maintenance.
|
|
|
|
Improve the quality of the libraries by providing issues and Pull Requests, or
|
|
|
|
donate through PayPal or GitHub sponsors.
|
|
|
|
|
|
|
|
Thank you,
|
|
|
|
|