Hi all,
I’m building a temperature monitoring unit to notify me when the temp in a room reaches a certain point. Currently, the notifications happen too frequently. I am not sure why as I’m using a flag to avoid sending more notifications while a condition is true. Code below:
void readTemp() {
DS18B20.requestTemperatures();
temp = DS18B20.getTempFByIndex(0);
Blynk.virtualWrite(0, temp);
if ((temp <= 55) && (notified == false)) {
Blynk.virtualWrite(V4, 1023);
String phoneAlarm = String("Mud room temp is low: ") + temp + " °F";
Blynk.notify(phoneAlarm);
Blynk.email("jcs44@njit.edu", "Temperature Alarm: Mud Room", "Mud room temp is below 55 °F.");
timer.setTimeout(30000L, resetNotified);
notified == true;
}
else {
Blynk.virtualWrite(V4, 0);
}
}
void resetNotified() {
notified = false;
}
FYI I initialize my boolean notified
to false
in my setup function. Any ideas?