Hardware Reference
In-Depth Information
111 {
112 // Pin will go low. Wait until it goes high
113 loopCnt = 255;
114 while(digitalRead(DHTPin) == LOW)
115 {
116 if (--loopCnt == 0) return NAN;
117 }
118
119 // What is the current time?
120 unsigned long t = micros();
121
122 // Pin will go high. Calculate how long it is high.
123 loopCnt = 255;
124 while(digitalRead(DHTPin) == HIGH)
125 {
126 if (--loopCnt == 0) return NAN;
127 }
128
129 // Is this a logical one, or a logical zero?
130 if ((micros() - t) > 40) data[idx] |= mask;
131 mask >>= 1;
132 if (mask == 0) // next byte?
133 {
134 mask = 128;
135 idx++;
136 }
137 }
138
139
140 // Get the data, and return it
141 float f = data[0];
142 return (int)f;
143 }
144
145
146 boolean sendEmail()
147 {
148 // Attempt to connect
149 if(!client.connect(server,25))
150 return false;
151
152 // Change this to your IP
153 client.write("helo 1.2.3.4\r\n");
154
155 // change to your email address (sender)
156 client.write("MAIL From: <plant@yourdomain.com>\r\n");
157
158 // change to recipient address
159 client.write("RCPT To: <you@yourdomain.com>\r\n");
160
Continues
Search WWH ::




Custom Search