I’m having a problem with blynk on a Saprkfun ESP32 The Thing Board. The problem is that after uploading the code everything works fine, but for some reason, after some time (it could be hours or minutes…) the device goes offline and I need to unplug it from the power source and plug it back in order for blynk to run again. I have never had the device online for more than a few hours…
I have already tried to different for loops, the simple on with just Blynk.run() command an a more complex one that checks if bool Blynk.connected is true or false. If it’s true it simply does Blynk.run otherwise it does Blynk.connect.
My code right now is:
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
bool isConnected;
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "My token is here";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Wifi SSID";
char pass[] = "Wifi Password.";
void setup()
{
Serial.begin(9600);
pinMode(5,OUTPUT);
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(14,OUTPUT);
pinMode(27,OUTPUT);
digitalWrite(5,LOW);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(14,HIGH);
digitalWrite(27,LOW);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
isConnected = Blynk.connected();
if (isConnected){
Blynk.run();
}
else{
Blynk.connect();
}
}