Sketch Blynk per IoT

brunello22:
prova ad aggiungere, sempre nel setup()

  timer.setInterval(1500L, programma);

Niente, facendo così ricevo le notifiche a ripetizione e la lettura dei sensori non funziona più.

Ho chiesto su un forum un mano e mi hanno detto di fare così ma vorrei una speigazione anche da voi perchè da noob quale sono non capisco comunque.

"Using another variable as a check for the notification being sent.
Introduce a new bool e.g. bool sentMessage = false;
then change:

if (livelloacqua < 160 && !sentMessage) {
    lcd.setCursor(0, 0);
    lcd.print("Riempire acqua      ");
    Blynk.notify("L'acqua è in esaurimento! Devi riempirla!");
    sentMessage  = true;
  }

when you refil you’ll need to reset this bool, so probably add sentMessage= false e.g.

if (livelloacqua >= 130) {

in this way you get the message only once. You can also add a timer that checks whether the bool = true and then sent a new message every 10006010 ms. (=10 minutes).

1 Like