1.
/* DHT11/ DHT22 Sensor Temperature and Humidity Tutorial
2. * Program made by Dejan Nedelkovski,
3. * [Link]
4. */
5. /*
6. * You can find the DHT Library from Arduino official website
7. * [Link]
8. */
9.
10. #include <dht.h>
11.
12. #define dataPin 8 // Defines pin number to which the sensor is connected
13. dht DHT; // Creats a DHT object
14.
15. void setup() {
16. [Link](9600);
17. }
18. void loop() {
19. int readData = DHT.read22(dataPin); // Reads the data from the sensor
20. float t = [Link]; // Gets the values of the temperature
21. float h = [Link]; // Gets the values of the humidity
22.
23. // Printing the results on the serial monitor
24. [Link]("Temperature = ");
25. [Link](t);
26. [Link](" *C ");
27. [Link](" Humidity = ");
28. [Link](h);
29. [Link](" % ");
30.
31. delay(2000); // Delays 2 secods, as the DHT22 sampling rate is 0.5Hz
32. }
1. /* DHT11/ DHT22 Sensor Temperature and Humidity Tutorial
2. * Program made by Dejan Nedelkovski,
3. * [Link]
4. */
5. /*
6. * You can find the DHT Library from Arduino official website
7. * [Link]
8. */
9.
10. #include <dht.h>
11.
12. #define dataPin 8 // Defines pin number to which the sensor is connected
13. dht DHT; // Creats a DHT object
14.
15. void setup() {
16. [Link](9600);
17. }
18. void loop() {
19. int readData = DHT.read22(dataPin); // Reads the data from the sensor
20. float t = [Link]; // Gets the values of the temperature
21. float h = [Link]; // Gets the values of the humidity
22.
23. // Printing the results on the serial monitor
24. [Link]("Temperature = ");
25. [Link](t);
26. [Link](" *C ");
27. [Link](" Humidity = ");
28. [Link](h);
29. [Link](" % ");
30.
31. delay(2000); // Delays 2 secods, as the DHT22 sampling rate is 0.5Hz
32. }