With 0.5.2 my Blynk is not connecting anymore… using Mega with Ethernet

The main loop doesn’t run …

And your sketch is?..

So here ist essential part of it

    #include <SPI.h>
    #include <Ethernet.h>
    #include <BlynkSimpleEthernet.h>

    // You should get Auth Token in the Blynk App.
    // Go to the Project Settings (nut icon).
    char auth[] = "xxxxx";   

    BlynkTimer timer;

    // Check connection every 30s
    void reconnectBlynk() {
      if (!Blynk.connected()) {
         Serial.println("Lost connection");
          if(Blynk.connect()) {
          Serial.println("Reconnected");
        }
        else {
          Serial.println("Not reconnected");
        }
      }
    }



     void setup()
        {
          // Debug console
          Serial.begin(115200);    // Schnittstelle zum PC
      
          pinMode(SDCARD_CS, OUTPUT);
          digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

          Blynk.begin(auth);
          while (Blynk.connect() == false) {
            }
 
          // Timer definition 
            timer.setInterval(30000L, reconnectBlynk);  // check every 30s if still connected to 
    }

    // ************************  LOOP *******************************
    void loop()
    {
      Blynk.run();
      timer.run(); // Initiates BlynkTimer
      Serial.print("Hello\n");        
}

tried Version 5.4. and it works on WIFI (nano) but I did not get it run with Ethernet shield W5100

Having this in the void loop() running thousands of times a second is unnecessary, and potentially bad for the Blynk communication timing.

As for the rest… well… nothing is there, what are you doing?

PS, running connection routines while using Blynk.begin() is a bit counter productive as that is a blocking command, preventing the code from running if there is no server connection. Look at first setting up your ethernet connection then using Blynk.config() instead.

:slight_smile: You are right , but the “Serial.print(“Hello\n”);” replesents just an example - not in real code, but even this does not work

even it does not come to the point that this is line of code is executed

You don’t even have these, or your ethernet, pins defined… how is it supposed to connect to your Ethernet :stuck_out_tongue_winking_eye:

I think you should start with a simple example…

https://examples.blynk.cc/?board=Arduino%20Mega%202560&shield=Ethernet%20Shield%20W5100&example=GettingStarted%2FPushData

thanks for the note - I don’t want to overload you with details - if I would have not defined these it would even not work with version 5.0 I assume :stuck_out_tongue_winking_eye:

THANKS for your time

Actually, without proper details and full code at the beginning, it is more a waste of our time.

SOLVED

This works:
Blynk.begin(auth, "blynk-cloud.com", 80);
this not
Blynk.begin(auth);

Hmm, generally the cloud and port are internally defaulted too by the Blynk Library, if not externally referenced… perhaps just a quirk with the ethernet connection? Regardless… working is working :slight_smile: