I am monitoring 4 sensors for my outside wood burner and my geothermal system. What I would like to do is when my outside wood burner input temp (Therm3) drops below 140 F to have an alarm go off. I am very new to coding but was able to make it this far using google and trial and error but I cannot figure out how to compare temperatures.
Any help is appreciated,
Chad
something like this
const int alarmPin = 5;
float alarmLevel = 140;
void setup()
{
Serial.begin(115200);
Serial.println("Start ");
digitalWrite(alarmPin, LOW);
pinMode(alarmPin, OUTPUT);
}
void loop()
{
float t = getTemperatureF(); // to be written
if (t >= alarmLevel)
{
digitalWrite(alarmPin, HIGH);
}
else
{
digitalWrite(alarmPin, LOW);
}
}
float getTemperatureF()
{
return 32; // to be written, depends on sensor used
}
Thanks, that helped! How can I pull the temperature from sensor 3 only? It appears that I am comparing all the sensors to the alarmlevel value, not just sensor 3.
Thanks for your help,
I do not have a sensor3 , can you send me one?
ok, I got it woot!!
float t = sensors.getTempF(Therm3);
if (alarmlevel > t) // check to see if Therm3 is below alarm level, if so sound alarm.
{
digitalWrite(ledPin, HIGH);
}
else
{
digitalWrite(ledPin, LOW);
}
}
thanks for your help
maybe post the whole code for future reference?