File tree Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Expand file tree Collapse file tree 4 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -140,7 +140,7 @@ uint8_t DHT22::readSensor(){
140
140
}
141
141
142
142
String DHT22::debug (){
143
- String d = " ### DEDUG ###\n look at datasheet for timing specs\n " ;
143
+ String d = " ### BEGIN DEDUG ###\n look at datasheet for timing specs\n " ;
144
144
measureTimings ();
145
145
146
146
d +=" t_80L\t t_80H\t t_50\t t_Bit0\t t_Bit1\n " ;
@@ -159,7 +159,7 @@ String DHT22::debug(){
159
159
d += String (getHumidity (),1 ) +" \t " ;
160
160
d += String (getTemperature (),1 ) +" \t " ;
161
161
if (err != ERR_CRC) d+=" TRUE" ; else d+=" FALSE" ;
162
- d+=" \n ### DEDUG ###" ;
162
+ d+=" \n ### END DEDUG ###" ;
163
163
return d;
164
164
}
165
165
Original file line number Diff line number Diff line change @@ -33,10 +33,10 @@ class DHT22{
33
33
uint8_t _timingBit0 = 27 ; // specs for AM2303
34
34
uint8_t _timingBit1 = 70 ; // specs for AM2303
35
35
bool _firstStart=true ;
36
- uint8_t _lastError;
36
+ error _lastError;
37
37
38
38
const uint8_t T = 30 ;
39
- const uint16_t cSamplingTime = 2100 ; // ms, dht22 sampling rate ~0.5Hz
39
+ const uint16_t cSamplingTime = 2100 ; // ms : dht22 sampling rate ~0.5Hz
40
40
41
41
public:
42
42
DHT22 (uint8_t pinData){
Original file line number Diff line number Diff line change @@ -10,15 +10,17 @@ void setup() {
10
10
}
11
11
12
12
void loop () {
13
- // Serial.println(dht22.debug()); //optionnal
13
+ Serial.println (dht22.debug ()); // optionnal
14
14
15
15
float t = dht22.getTemperature ();
16
16
float h = dht22.getHumidity ();
17
17
18
- if (dht22.getLastError () != dht22.OK )
18
+ if (dht22.getLastError () != dht22.OK ) {
19
+ Serial.print (" last error :" );
19
20
Serial.println (dht22.getLastError ());
21
+ }
20
22
21
23
Serial.print (" h=" );Serial.print (h,1 );Serial.print (" \t " );
22
24
Serial.print (" t=" );Serial.println (t,1 );
23
- delay (1000 );
25
+ delay (2000 ); // Collecting period should be : >1.7 second
24
26
}
Original file line number Diff line number Diff line change 1
1
name =DHT22
2
- version =1.0.5
2
+ version =1.0.6
3
3
author =dvarrel
4
4
maintainer =dvarrel
5
5
includes =DHT22.h
You can’t perform that action at this time.
0 commit comments