-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrz_dht.h
58 lines (45 loc) · 1.13 KB
/
rz_dht.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
TITLE:
rz_dht.h
BRIEF:
library
DESC:
Arduino lib for ESP32 DHT11, DHT22 (AM2302), DHT21 (AM2301) Sensors
SOURCE:
https://github.com/Zheng-Bote/esp32_libs
SYNTAX:
#include "rz_dht.h"
RZ_DHT *dhtsensor = new RZ_DHT();
void readData();
String getTemperature();
String getHumidity();
bool getSensorStatus();
RETURN:
void // read current sensor data
String temperature // 23.15 // °C
String humidity // 45.55 // %
bool error // true = sensor error, false = sensor reading ok
HISTORY:
Version | Date | Developer | Comments
------- | ---------- | ---------- | ---------------------------------------------------------------
1.0.0 | 2022-02-26 | RZheng | created
1.1.0 | 2022-02-27 | RZheng | fixed: some low quality DHT sensors needs 1 second pause
*/
#ifndef rz_dht_h
#define rz_dht_h
#include "Arduino.h"
class RZ_DHT {
public:
RZ_DHT();
void readData();
String getTemperature();
String getHumidity();
bool getSensorStatus();
private:
float _dhtTemperature;
float _dhtHumidity;
bool _sensorError;
~RZ_DHT() {
}
};
#endif