-
Notifications
You must be signed in to change notification settings - Fork 0
/
DHT_sensors_3D_tank.ino
115 lines (76 loc) · 2.06 KB
/
DHT_sensors_3D_tank.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// DHT humidity/temperature sensors
// Written by Ana MC Ilie
#include "DHT.h"
#define DHTPINA A0
#define DHTPINB A1
#define DHTPINC A2
#define DHTPIND A3
#define DHTPINE A4
#define DHTPINF A5
#define DHTTYPEA DHT11
#define DHTTYPEB DHT11
#define DHTTYPEC DHT11
#define DHTTYPED DHT11
#define DHTTYPEE DHT11
#define DHTTYPEF DHT11
// Initialize DHT sensor for normal 16mhz Arduino
DHT dhta(DHTPINA, DHTTYPEA);
DHT dhtb(DHTPINB, DHTTYPEB);
DHT dhtc(DHTPINC, DHTTYPEC);
DHT dhtd(DHTPIND, DHTTYPED);
DHT dhte(DHTPINE, DHTTYPEE);
DHT dhtf(DHTPINF, DHTTYPEF);
void setup() {
Serial.begin(9600);
dhta.begin();
dhtb.begin();
dhtc.begin();
dhtd.begin();
dhte.begin();
dhtf.begin();
Serial.println(",RHa,Ta,RHb,Tb,RHc,Tc,RHd,Td,RHe,Te,RHf,Tf");
}
void loop() {
// Wait a few seconds between measurements.
delay(2000);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds
// Read temperature as Celsius
float ha = dhta.readHumidity();
float ta = dhta.readTemperature();
float hb = dhtb.readHumidity();
float tb = dhtb.readTemperature();
float hc = dhtc.readHumidity();
float tc = dhtc.readTemperature();
float hd = dhtd.readHumidity();
float td = dhtd.readTemperature();
float he = dhte.readHumidity();
float te = dhte.readTemperature();
float hf = dhtf.readHumidity();
float tf = dhtf.readTemperature();
// Print out the values
Serial.print(",");
Serial.print(ha);
Serial.print(",");
Serial.print(ta);
Serial.print(",");
Serial.print(hb);
Serial.print(",");
Serial.print(tb);
Serial.print(",");
Serial.print(hc);
Serial.print(",");
Serial.print(tc);
Serial.print(",");
Serial.print(hd);
Serial.print(",");
Serial.print(td);
Serial.print(",");
Serial.print(he);
Serial.print(",");
Serial.print(te);
Serial.print(",");
Serial.print(hf);
Serial.print(",");
Serial.println(tf);
}