DS18B20 and occasional bogus readings

robtillaart:

How would I go about getting it to display the temperature to only one decimal point? It doesn't need to be quite as precise as 20.59C! 20.5, 20.3, etc would do nicely smiley-wink

I'd also like to know how to just display a single decimal point.. XX.X F is all I need.

chance line to lcd.print(sensors.getTempCByIndex(0), 1); // 1 decimal place => Note : 2 is the default

For Fahrenheit the trick is similar :wink: lcd.print(sensors.getTempCByIndex(0)*1.8 +32, 1);

Awesome!!

void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
lcd.print(DallasTemperature::toFahrenheit(tempC), 1);
}

Worked like a charm!

Greatly appreciated.. and Happy New year! :smiley: