Blynk time out bypass?

Hi guys.

I am using a feather huzzah 8266 to read two interrupts. I noticed my huzzah times out of the blynk app if it’s inactive. But the moment o reset the module it comes online and works as expected. Is there a built in timeout for the app. If so is there a way to disable it. Or is there away to add code into the sketch to ensure it keeps connected.

I am showing a demo and am pretty worried I will have to do a reset just before which is not the most ideal way to show off the iot project.

Secondly, the sketch performs differently after a while but as soon as it it’s reset (unplug the board and replug it in) it works again as expected.

Happy to share the code to see if there is any thing I am doing wrong or if there is improvements I can make.

Thanks
Bkynk182

That’s not how it should work, so I guess it’s bad coding.
If you share your code please remember to add triple backticks to ensure that it displays correctly.

Pete.

This is the code with the auth and wifi pass blocked out. I am uploading using platformio. Fyi the Widgetterminal is not fully implemented but I do not think this is the reason for the timeout.

Simple sketch. Two interrupt that trigger the same function and update the blynk app.




#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define RLED 0
#define BLED 2
 
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "*****************";

// Your WiFi credentials.
// Set password to "" for open networks.

char ssid[] = "*****";
char pass[] = "****";
WidgetLED led1(V21);
WidgetLED led2(V23);
WidgetLCD lcd(V22);
WidgetTerminal terminal(V1);
int counter =0;
long time;
long start;
long stop;
void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  digitalWrite(0, LOW);

  //interrupt 1
  pinMode(BLED, INPUT);
  attachInterrupt(0, &toggle, FALLING);
  
   //interrupt 2
  pinMode(RLED, INPUT);
  attachInterrupt(2, &toggle, FALLING);
  
}


void loop()
{
  Blynk.run();

}

void toggle() {
 counter = counter +1;
        Serial.println("Interrupt");
        lcd.clear(); //Use it to clear the LCD Widget
        if (counter%2 ==0){
            led1.on();
            led2.off();
            start = millis();

            long delta = abs((stop - start)/1000); 

            Blynk.virtualWrite(V0, delta); //sending to Blynk

        }else{
            led1.off();
            led2.on();
            stop = millis();

            long delta = abs((stop - start)/1000); 

            Blynk.virtualWrite(V0, delta); //sending to Blynk
        }

        lcd.print(0,0, "Daily Metrics:");
        lcd.print(0,1,(counter));  
        terminal.println(millis());       
        
}

What version of the ESP core are you using?

Pete.