Hi, I've just cut and pasted the following code:
#include <SimpleDHT.h>
// for DHT11,
// VCC: 5V or 3V
// GND: GND
// DATA: 2
int pinDHT11 = 2;
SimpleDHT11 dht11;
void setup() {
Serial.begin(9600);
}
void loop() {
// start working...
Serial.println("=================================");
Serial.println("Sample DHT11...");
// read without samples.
byte temperature = 0;
byte humidity = 0;
if (dht11.read(pinDHT11, &temperature, &humidity, NULL)) {
Serial.print("Read DHT11 failed.");
return;
}
Serial.print("Sample OK: ");
Serial.print((int)temperature); Serial.print(" *C, ");
Serial.print((int)humidity); Serial.println(" %");
// DHT11 sampling rate is 1HZ.
delay(1000);
}
Here's a sample of the output:
ead DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Sample OK: 18 *C, 50 %
=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Read DHT11 failed.=================================
Sample DHT11...
Sample OK: 17 *C, 48 %
=================================
Sample DHT11...
Why is it failing so often?
Also, where could i get more info on the SimpleDHT11 class. I can find very little info on it. I want to know more about the four components in the read function. I'm probably using the wrong terms here.
As you may have guessed I'm only starting out so dumb down the questions/comments!