Disconnection problem with Blynk Legacy Local Server

Hi i using old blynk server on a raspberry pi 4 and a esp32devkitV1.
i dont know what effecting this but every minute ore so the the ESP32 losing connection to the server and reconnecting by it self.

i used this toturial to install the blynk server on raspberry pi: https://www.youtube.com/watch?v=w9uRlOT3svU

im gonna use this code later for a home made auto-pilot with servo for an electric outboard.
this code is just all the funktions from blynk in the script.

why is it losing connection ?


#define BLYNK_TEMPLATE_ID ""
#define BLYNK_TEMPLATE_NAME ""
#define BLYNK_AUTH_TOKEN ""




#define BLYNK_PRINT Serial



#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Blynk.h>



//char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "";
char pass[] = "";

int storedHeading;



void setup() {
  Serial.begin(115200);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,16), 8080);
}



BLYNK_WRITE(V1)
{
 if(param.asInt()==1)
  {
    storedHeading++;  //increases the value of the "storedHeading" variable each time the push button of the left is pressed
    //delay(5); //5 milliseconds of delay
  }
}



BLYNK_WRITE(V2)
{
 if(param.asInt()==1)
{
 storedHeading--;  //decreases the value of the "storedHeading" variable each time the push button of the right is pressed
 //delay(5); //5 milliseconds of delay
}
}



BLYNK_WRITE(V3)
{
  if(param.asInt()==1)
{
  storedHeading += 10;  //increases the value of the "storedHeading" variable  with +10 each time the push button of the right is pressed
  //delay(5); //5 milliseconds of delay
}
}


BLYNK_WRITE(V4)
{
 if(param.asInt()==1)
{
  storedHeading -= 10;  //decreases the value of the " storedHeading" variable with -10 each time the push button of the right is pressed
 // delay(5); //5 milliseconds of delay
}
}



BLYNK_WRITE(V5)
{
 if(param.asInt()==1)
{
  storedHeading = 0; // cancel  "storedHeading"
  //delay(5); //5 milliseconds of delay
}
}

void loop() {
  Blynk.run();
  Serial.print("storedHeading");
  Serial.println(storedHeading);
}

@bones Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Copy and paste these if you can’t find the correct symbol on your keyboard.

Pete.

1 Like

I’ve moved this to a new topic, as it isn’t connected with the topic you posted in.

Which version of the Blynk C++ library you are using (which should be 0.6.1) and which version of Blynk Local Server you are running (which should be 0.41.17)

Why do you have these Blynk.IOT related lines of code if you’re using Legacy?…

Why do you have this #include in your sketch?…

What does your serial monitor show? (Copy/paste the text and use triple backticks as you did with your code)

How did you obtain your Auth token?

Pete.

i seams the newer version of BlynkC++ need a TEMPLATE_ID to compile…

i did change change the library version of blynk in arduino to 0.6.1 and skipped to include blynk.h and now every thing work super fine.

gonna ty it out on my main script when i got the hardwere parts later this month.

thank you allot Pete

new script look like this →

#define BLYNK_TEMPLATE_NAME ""
#define BLYNK_AUTH_TOKEN ""


#define BLYNK_PRINT Serial



#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>



char ssid[] = "";
char pass[] = "";

int storedHeading;



void setup() {
  Serial.begin(115200);
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass, IPAddress(192,168,1,16), 8080);
}



BLYNK_WRITE(V1)
{
 if(param.asInt()==1)
  {
    storedHeading++;  //increases the value of the "pos" variable each time the push button of the left is pressed
    //delay(5); //5 milliseconds of delay
  }
}



BLYNK_WRITE(V2)
{
 if(param.asInt()==1)
{
 storedHeading--;  //decreases the value of the "pos" variable each time the push button of the right is pressed
 //delay(5); //5 milliseconds of delay
}
}



BLYNK_WRITE(V3)
{
  if(param.asInt()==1)
{
  storedHeading += 10;  //decreases the value of the "pos" variable each time the push button of the right is pressed
  //delay(5); //5 milliseconds of delay
}
}


BLYNK_WRITE(V4)
{
 if(param.asInt()==1)
{
  storedHeading -= 10;  //decreases the value of the "pos" variable each time the push button of the right is pressed
 // delay(5); //5 milliseconds of delay
}
}



BLYNK_WRITE(V5)
{
 if(param.asInt()==1)
{
  storedHeading = 0;
  //delay(5); //5 milliseconds of delay
}
}

void loop() {
  Blynk.run();
  Serial.print("storedHeading");
  Serial.println(storedHeading);
}

That’s one of the (minor) reasons why you should be using 0.6.1

You should delete this line…

Pete.

2 posts were split to a new topic: Disconnection Problem with Blynk IoT