File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -6,9 +6,10 @@ written by Adafruit Industries
6
6
7
7
#include " DHT.h"
8
8
9
- DHT::DHT (uint8_t pin, uint8_t type) {
9
+ DHT::DHT (uint8_t pin, uint8_t type, uint8_t count ) {
10
10
_pin = pin;
11
11
_type = type;
12
+ _count = count;
12
13
firstreading = true ;
13
14
}
14
15
@@ -129,7 +130,7 @@ boolean DHT::read(void) {
129
130
if ((i >= 4 ) && (i%2 == 0 )) {
130
131
// shove each bit into the storage bytes
131
132
data[j/8 ] <<= 1 ;
132
- if (counter > 6 )
133
+ if (counter > _count )
133
134
data[j/8 ] |= 1 ;
134
135
j++;
135
136
}
Original file line number Diff line number Diff line change @@ -23,13 +23,13 @@ written by Adafruit Industries
23
23
class DHT {
24
24
private:
25
25
uint8_t data[6 ];
26
- uint8_t _pin, _type;
26
+ uint8_t _pin, _type, _count ;
27
27
boolean read (void );
28
28
unsigned long _lastreadtime;
29
29
boolean firstreading;
30
30
31
31
public:
32
- DHT (uint8_t pin, uint8_t type);
32
+ DHT (uint8_t pin, uint8_t type, uint8_t count= 6 );
33
33
void begin (void );
34
34
float readTemperature (bool S=false );
35
35
float convertCtoF (float );
You can’t perform that action at this time.
0 commit comments