Hi friends
About this title I have a question.
I make a system with 5 dht11 sensors with sd card for logger.
The problem is that a few days ago 1 sensor goes out with too much humidity.
My code was based on this example.
/*
*/
//sensors dig pin 2 and 3 e power 3.3v
#include <DHT11.h>
DHT11 dht11(2);
DHT11 dht12(3);
void setup()
{
Serial.begin(9600);
}
void loop()
{
int err;
float temp, humi;
if((err=dht11.read(humi, temp))==0)
{
Serial.print("temperature:");
Serial.print(temp);
Serial.print(" humidity:");
Serial.print(humi);
Serial.println();
}
else
{
Serial.println();
Serial.print("Error No :");
Serial.print(err);
Serial.println();
}
{
int err;
float temp, humi;
if((err=dht12.read(humi, temp))==0)
{
Serial.print("temperature:");
Serial.print(temp);
Serial.print(" humidity:");
Serial.print(humi);
Serial.println();
}
else
{
Serial.println();
Serial.print("Error No :");
Serial.print(err);
Serial.println();
}
}
delay(5000); //delay for reread
}
So can you help me to change loop if sensor 1 or 2 is broken or not connected and loop not stops?
It can read sensor one and for sensor 2 (broken or not connected ) writes “error reading” or something and continues the loop. In my system has 1 of them broken and after that no more readings in sd card.
Thanks in advance.
cpalha