Hello, I am looking to see if someone can point me in the right direction with my project. I have several DS18B20 Sensors connected to my system. I have defined them each with there own name and addresse so I can call for each one individually instead of in the an array where you get first connected first place, second connected second place, etc. My question is this - If one of my sensors goes down(stops working, gets disconnected) how do i set the Sensors value to be the DEVICE_DISCONNECTED value that I find in the DallasTemperature.h file? For Example when I am testing my sketch and I have no sensors connected it reads 0 C, I would like to see this read the DEVICE_DISCONNECTED value of -127. Any ideas would be greatly appreciated.
It looks like the validAddress or isConnected functions would let you check whether the device is still usable.
I got this to work finally. I had not declared some stuff correctly. I needed to add the sensors. in front of my isConnected to get this to work. Thanks for the help
if (!sensors.isConnected(OutsideSensor))
{
TempArray[0] = CtoF(sensors.getTempC(OutsideSensor)); // Outside Temperature Read.
}
else {
TempArray[0] = DEVICE_DISCONNECTED;
}
Serial.print(TempArray[0]);
Serial.println(" F Outside Temperature \n");