I’ve been using my code and the DS18B20 Library (V 0.1.3) for a couple of years with just one sensor. I just updated some code and created a new app with the latest DB18B20 Library(V 0.1.8) and all I get is nan for readings. I double checked my code, but can’t find anything wrong. As a last attempt I pasted the new code into the older app with the older version of the Library and everything works fine.
Anyplace I can find what changes were made or if anyone can clue me into what changed so I can correct my new app?
Any help would be appreciated.
Here is my code - which was working very well with no error readings:
if(!ds18b20.search()){
ds18b20.resetsearch();
celsiusTemp = ds18b20.getTemperature();
// Serial.println(celsius);
while (!ds18b20.crcCheck() && dsAttempts < 3){
// Serial.println("Caught bad value.");
dsAttempts++;
// Serial.print("Attempts to Read: ");
// Serial.println(dsAttempts);
if (dsAttempts < 3){
// Spark.publish("PNotification", "Temp Reset", PRIVATE);
LED_Red_Flash(2,5,2,96);
delay(1000);
// celsius = celsiusTemp;
}
continue;
}
dsAttempts = 0;
ds18b20.resetsearch();
celsiusTemp = ds18b20.getTemperature();
}
if(ds18b20.crcCheck()){
celsius = celsiusTemp;
fahrenheit = ds18b20.convertToFahrenheit(celsius);}