I am new to Arduino and I am trying to make a thermostat but I can`t seem to get the right command to the temperature, cahelp me/tell me what iam doing wrong?
Iam using:
Not familiar with the DS18B20, but looking at the code getTempCByIndex seems to return a value.
Serial.print(sensor.getTempCByIndex(0));
No idea if that is a float or an int or ..., but you can store that value in a variable of the correct type. And you can use that variable in your if statement.
Sorry about that guys, I am new to this forum.
The point about this code is to trigger the yellow led (pin13) when the thermostat is lower than 29 celsius, and to shut it of when it is over 30 celsius.
But you're still checking the word "float" to see if it is less than 29.
Is the temperature that is printed to the lcd and in the Serial monitor correct? If it is then you want to use the same value in your if statements. Something like "if (sensor.getTempCByIndex(0) <= 29)".
Or even better save the value in a variable like currentTemp = sensor.getTempCByIndex(0) and then use currentTemp in all your prints and ifs.