Skip to content

Commit db1a794

Browse files
authored
Merge pull request #144 from AghaSaad04/master
[Documentation]
2 parents bcb7767 + e194e63 commit db1a794

File tree

2 files changed

+167
-6
lines changed

2 files changed

+167
-6
lines changed

CONTRIBUTING.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Contribution Guidlines
2+
3+
This library is the culmination of the expertise of many members of the open source community who have dedicated their time and hard work. The best way to ask for help or propose a new idea is to [create a new issue](https://github.com/adafruit/DHT-sensor-library/issues/new) while creating a Pull Request with your code changes allows you to share your own innovations with the rest of the community.
4+
5+
The following are some guidelines to observe when creating issues or PRs:
6+
7+
- Be friendly; it is important that we can all enjoy a safe space as we are all working on the same project and it is okay for people to have different ideas
8+
9+
- [Use code blocks](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet#code); it helps us help you when we can read your code! On that note also refrain from pasting more than 30 lines of code in a post, instead [create a gist](https://gist.github.com/) if you need to share large snippets
10+
11+
- Use reasonable titles; refrain from using overly long or capitalized titles as they are usually annoying and do little to encourage others to help :smile:
12+
13+
- Be detailed; refrain from mentioning code problems without sharing your source code and always give information regarding your board and version of the library

README.md

Lines changed: 154 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,162 @@
11
# Adafruit DHT Humidity & Temperature Sensor Library [![Build Status](https://travis-ci.com/adafruit/DHT-sensor-library.svg?branch=master)](https://travis-ci.com/adafruit/DHT-sensor-library)
22

3-
An Arduino library for the DHT series of low cost temperature/humidity sensors.
3+
## Description
44

5-
Tutorial: https://learn.adafruit.com/dht
5+
An Arduino library for the DHT series of low-cost temperature/humidity sensors.
66

7-
**You must have the following Arduino libraries installed to use this class:**
7+
You can find DHT tutorials [here](https://learn.adafruit.com/dht).
88

9-
- [Adafruit Unified Sensor Library](https://github.com/adafruit/Adafruit_Sensor)
9+
## Installation
1010

11-
Examples include both a "standalone" DHT example, and one that works along with the Adafruit Unified Sensor Library. Unified sensor library is required even if using the standalone version.
11+
### First Method
1212

13-
Recent Arduino IDE releases include the Library Manager for easy installation. Otherwise, to download, click the DOWNLOADS button in the top right corner, rename the uncompressed folder DHT. Check that the DHT folder contains DHT.cpp and DHT.h. Place the DHT library folder your <arduinosketchfolder>/libraries/ folder. You may need to create the libraries subfolder if its your first library. Restart the IDE.
13+
![image](https://user-images.githubusercontent.com/36513474/67982415-773d6a00-fc44-11e9-8741-8185da71e785.png)
1414

15+
1. In the Arduino IDE, navigate to Sketch > Include Library > Manage Libraries
16+
1. Then the Library Manager will open and you will find a list of libraries that are already installed or ready for installation.
17+
1. Then search for DHT-sensor using the search bar.
18+
1. Click on the text area and then select the specific version and install it.
19+
20+
### Second Method
21+
22+
1. Navigate to the Releases page.
23+
1. Download the latest release.
24+
1. Extract the zip file
25+
1. In the Arduino IDE, navigate to Sketch > Include Library > Add .ZIP Library
26+
27+
## Requirements
28+
29+
This library depends on [Adafruit Unified Sensor Library](https://github.com/adafruit/Adafruit_Sensor). To use this library the user must download the required library.
30+
31+
## Features
32+
33+
- ### Inexpensive
34+
35+
This library is used with low-cost temperature and humidity sensors, for example, DHT11 and DHT22. This library is free of cost and the only cost is of the sensors.
36+
37+
- ### Compatible
38+
39+
DHT sensor library is compatible with multiple low-cost temperature and humidity sensors like DHT11 and DHT22. A few examples are implemented just to demonstrate how to modify the code for different sensors.
40+
41+
- ### Function calls
42+
43+
Basic functions of the low-cost temperature/humidity sensors have been implemented in this library. There's no need to re-implement these functions from scratch. The user simply has to import the library in the project and can use any of its functions by just calling it.
44+
45+
- ### Give back
46+
47+
The library is free, you don’t have to pay for anything. However, if you want to support the development, or just thank the author of the library by purchasing products from Adafruit!
48+
49+
Not only you’ll encourage the development of the library, but you’ll also learn how to best use the library and probably some C++ too
50+
51+
- ### MIT License
52+
53+
DHT sensor library is open-source and uses one of the most permissive licenses so you can use it on any project.
54+
55+
- Commercial use
56+
- Modification
57+
- Distribution
58+
- Private use
59+
60+
## Functions
61+
62+
- begin()
63+
- readTemperature()
64+
- convertCtoF()
65+
- convertFtoC()
66+
- readHumidity()
67+
- computeHeatIndex()
68+
- read()
69+
- expectPulse()
70+
71+
## Example
72+
73+
Examples include both a "standalone" DHT example and one that works along with the Adafruit Unified Sensor Library. A Unified sensor library is required even if using the standalone version. You can find other examples from [Github-DHT-sensor-library](https://github.com/adafruit/DHT-sensor-library/tree/master/examples).
74+
75+
```Cpp
76+
#include "DHT.h"
77+
78+
#define DHTPIN 2
79+
#define DHTTYPE DHT22
80+
DHT dht(DHTPIN, DHTTYPE);
81+
82+
void setup() {
83+
Serial.begin(9600);
84+
Serial.println(F("DHTxx test!"));
85+
86+
dht.begin();
87+
}
88+
89+
void loop() {
90+
delay(2000);
91+
92+
float h = dht.readHumidity();
93+
float t = dht.readTemperature();
94+
float f = dht.readTemperature(true);
95+
96+
if (isnan(h) || isnan(t) || isnan(f)) {
97+
Serial.println(F("Failed to read from DHT sensor!"));
98+
return;
99+
}
100+
101+
float hif = dht.computeHeatIndex(f, h);
102+
float hic = dht.computeHeatIndex(t, h, false);
103+
104+
Serial.print(F("Humidity: "));
105+
Serial.print(h);
106+
Serial.print(F("% Temperature: "));
107+
Serial.print(t);
108+
Serial.print(F("°C "));
109+
Serial.print(f);
110+
Serial.print(F("°F Heat index: "));
111+
Serial.print(hic);
112+
Serial.print(F("°C "));
113+
Serial.print(hif);
114+
Serial.println(F("°F"));
115+
}
116+
```
117+
118+
## Contributing
119+
120+
If you want to contribute to this project:
121+
122+
- Report bugs and errors
123+
- Ask for enhancements
124+
- Create issues and pull requests
125+
- Tell others about this library
126+
- Contribute new protocols
127+
128+
Please read [CONTRIBUTING.md](https://github.com/adafruit/DHT-sensor-library/blob/master/CONTRIBUTING.md) for details on our code of conduct, and the process for submitting pull requests to us.
129+
130+
## Credits
131+
132+
The author and maintainer of this library is Adafruit <[email protected]>
133+
134+
Based on previous work by:
135+
136+
- T. DiCola
137+
- P. Y. Dragon
138+
- L. Fried
139+
- J. Hoffmann
140+
- M. Kooijman
141+
- J. M. Dana
142+
- S. Conaway
143+
- S. IJskes
144+
- T. Forbes
145+
- B. C
146+
- T. J Myers
147+
- L. Sørup
148+
- per1234
149+
- O. Duffy
150+
- matthiasdanner
151+
- J. Lim
152+
- G. Ambrozio
153+
- chelmi
154+
- adams13x13
155+
- Spacefish
156+
- I. Scheller
157+
- C. Miller
158+
- 7eggert
159+
160+
## License
161+
162+
This library is licensed under [MIT license](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)