-
-
Notifications
You must be signed in to change notification settings - Fork 15
/
dhtnew_suppressError.ino
68 lines (49 loc) · 1.37 KB
/
dhtnew_suppressError.ino
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
59
60
61
62
63
64
65
66
67
//
// FILE: dhtnew_suppressError.ino
// AUTHOR: Rob Tillaart
// PURPOSE: DHTNEW library test sketch
// URL: https://github.com/RobTillaart/DHTNew
// DHT PIN layout from left to right
// =================================
// FRONT : DESCRIPTION
// pin 1 : VCC
// pin 2 : DATA
// pin 3 : Not Connected
// pin 4 : GND
// run sketch without connected sensor to see effect
#include <dhtnew.h>
DHTNEW mySensor(5); // ESP 16 UNO 5 MKR1010 5
uint32_t count = 0;
void setup()
{
while(!Serial); // MKR1010 needs this
Serial.begin(115200);
Serial.println(__FILE__);
Serial.println();
// MKR1010 needs this
// mySensor.setDisableIRQ(false);
// test flag working => prints 010
Serial.print(mySensor.getSuppressError());
mySensor.setSuppressError(true);
Serial.print(mySensor.getSuppressError());
mySensor.setSuppressError(false);
Serial.print(mySensor.getSuppressError());
// change to false to see difference
mySensor.setSuppressError(true);
Serial.println();
}
void loop()
{
if (millis() - mySensor.lastRead() > 2000)
{
if ((count % 10) == 0) Serial.println("\nERR\tHUM\tTEMP");
count++;
int errcode = mySensor.read();
Serial.print(errcode);
Serial.print("\t");
Serial.print(mySensor.getHumidity(), 1);
Serial.print("\t");
Serial.println(mySensor.getTemperature(), 1);
}
}
// -- END OF FILE --