Sorry for the late reply, I was having online classes.
Here is the original code’s memory usage screenshot:
I have tried printing the dO
value on Serial instead of sending it to Blynk, but the app still disconnects and reconnects and no serial output of the dO
value (only the Blynk print). Adding a millis()
delay of 5 seconds does not help.
Regarding the timers, I actually got it from Jamin in this topic:
Not sure if I have misunderstood something in the discussion…
I tried staggering my timers like this:
timer.setTimeout(100, []() {
timer.setInterval(5010L, getTemp);
});
timer.setTimeout(200, []() {
timer.setInterval(5020L, getTdsEc);
});
timer.setTimeout(300, []() {
timer.setInterval(5030L, getTurbidity);
});
timer.setTimeout(400, []() {
timer.setInterval(5040L, getpH);
});
timer.setTimeout(500, []() {
timer.setInterval(5050L, getDO);
});
timer.setTimeout(600, []() {
timer.setInterval(6000L, tempAlarm);
});
timer.setTimeout(700, []() {
timer.setInterval(6010L, pHAlarm);
});
timer.setTimeout(800, []() {
timer.setInterval(10000L, alarmSound);
});
and this:
timer.setTimeout(100, []() {
timer.setInterval(5000L, getTemp);
});
timer.setTimeout(200, []() {
timer.setInterval(10000L, getTdsEc);
});
timer.setTimeout(300, []() {
timer.setInterval(15000L, getTurbidity);
});
timer.setTimeout(400, []() {
timer.setInterval(20000L, getpH);
});
timer.setTimeout(500, []() {
timer.setInterval(25000L, getDO);
});
timer.setTimeout(600, []() {
timer.setInterval(6000L, tempAlarm);
});
timer.setTimeout(700, []() {
timer.setInterval(12000L, pHAlarm);
});
timer.setTimeout(800, []() {
timer.setInterval(30000L, alarmSound);
});
as well as this:
timer.setTimeout(250, []() {
timer.setInterval(5000L, getTemp);
});
timer.setTimeout(500, []() {
timer.setInterval(10000L, getTdsEc);
});
timer.setTimeout(750, []() {
timer.setInterval(15000L, getTurbidity);
});
timer.setTimeout(1000, []() {
timer.setInterval(20000L, getpH);
});
timer.setTimeout(1250, []() {
timer.setInterval(25000L, getDO);
});
timer.setTimeout(1500, []() {
timer.setInterval(6000L, tempAlarm);
});
timer.setTimeout(1750, []() {
timer.setInterval(12000L, pHAlarm);
});
timer.setTimeout(2000, []() {
timer.setInterval(30000L, alarmSound);
});
but they all do not work. Am I doing it right? From what I understand, using the setTimeout method should call the functions sequentially even though the setInterval duration are the same.
also forgot to note that when the app disconnects and reconnects, this code in the setup seems to not run:
for (int i = 0; i < 3; i++) {
tone(spkPin, 1046.50, 10);
delay(100);
}
so no beeping at all…