-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArduino.ino
More file actions
54 lines (48 loc) · 999 Bytes
/
Arduino.ino
File metadata and controls
54 lines (48 loc) · 999 Bytes
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
//
// FILE: dht11_test.ino
// AUTHOR: Rob Tillaart
// VERSION: 0.1.01
// PURPOSE: DHT library test sketch for DHT11 && Arduino
// URL:
//
// Released to the public domain
//
#include <dht.h>
dht DHT;
#define DHT11_PIN 3
void setup()
{
Serial.begin(115200);
//Serial.println("DHT TEST PROGRAM ");
//Serial.print("LIBRARY VERSION: ");
//Serial.println(DHT_LIB_VERSION);
// Serial.println();
//Serial.println("Type,\tstatus,\tHumidity (%),\tTemperature (C)");
}
void loop()
{
// READ DATA
//Serial.print("DHT11, \t");
int chk = DHT.read11(DHT11_PIN);
switch (chk)
{
case DHTLIB_OK:
//Serial.print("OK");
break;
case DHTLIB_ERROR_CHECKSUM:
//Serial.print("Checksum error");
break;
case DHTLIB_ERROR_TIMEOUT:
// Serial.print("Time out error");
break;
}
// DISPLAY DATA
Serial.print(DHT.humidity, 1);
Serial.print(",");
Serial.println(DHT.temperature, 1);
Serial.print("\n");
delay(2000);
}
//
// END OF FILE
//