Continuous reading of temperature sensors

In the file attached I am trying to get a continuous read from two temperature sensors and if one sensor (roomTemp) reads above 86 it should change the LCD to show “Penthouse Hi Temp”. Right now it just always displays “Penthouse Hi Temp” even though I know that the temp is below the 86.00. I even added the code that shows what temp the sensors are reading and it well below the 86.00. Am I missing something? Thanks in advance.
lcd.clear ();
lcd.print("Room Temp: ");
lcd.print("Duct Temp: ");

_2temp_LCD_v34.ino (2.13 KB)

What is int roomTemp? a value or a sensor address ?
Also you test int against 86.00 , at best it will test only int 86 anyway, not the decimals.
Add some Serial prints to make it easier to czech your code . Na tehrei is nothing wrong in setting the roomTemp, after you get the value , to test you code even without Serial.
Good luck.

DeviceAddress roomTemp = {
if (int(roomTemp) >= 86.00)

Doesn't seem likely that a DeviceAddress can sensibly be converted to an "int".

I see what you are saying. However if I put "printTemperature(roomTemp); and printTemperature(ductTemp);" in the if section of the If Else statement it does output a number in the xx.xx format (i.e. 71.15 for roomTemp and 71.67 for ductTemp). So I changed the line that said if (int(roomTemp) >= 86.00) to "if (printTemperature(roomTemp) >= 86.00)" thinking that passing it through the function would give me what I wanted. When I change that line I could not compile the code any longer. It through the following error: "_2temp_LCD_v34.ino: In function 'void loop()': _2temp_LCD_v34:72: error: void value not ignored as it ought to be "

I changed the "void loop(void)" to "void loop()" with no change in the error. I just need for this to continuously run and alert if the temp exceeds 86. Maybe the void loop() is not what I need to use. Any suggestions? Thanks for the responses!

First, this:


Why are you doing a Celsius->Farenheit conversion, then storing the result back in a Celsius variable?

As to your error, the printTemperature function returns a void value (ie, it returns nothing). You can't use it in a comparison. try replacing:

if (int(roomTemp) >= 86.00)


if( DallasTemperature::toFarenheit(sensors.getTempC(roomTemp))>=86.00 )

Thanks for the reply. You were right it does not make sense to store the converted value back into a Celsius variable. You were also right on the other issue replacing my code with the one you provided gave me the results I was looking for. Thanks again for taking a look!