BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Time out in localserver

hi guys. i have a problem.
i want to connect blynk to my localblynk but i have a problem:
my nodemcu code:

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

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

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  Blynk.begin(auth, ssid, pass, IPAddress(192,168,41,2));
}

void loop()
{
  Blynk.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

and the problem is nodemcu monitor:

[492107] Connecting to blynk-cloud.com:80
[495144] Login timeout

why it cannot connect?!

You have two Blynk.begin commands. The first tries to connect to Blynk cloud. When it doesn’t succeed the code does not progress to the second one, because Blynk.begin is a blocking command.

Pete.

1 Like

tnq for answering mr pete.
i delete “Blynk.begin(auth, ssid, pass);”
but my code cannot connect to blynk locla server (“192.168.41.2:9443”)

my nodemcu cdoe:
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

// 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[] = "******";

void setup()
{
  // Debug console
  Serial.begin(9600);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  Blynk.begin(auth, ssid, pass, IPAddress(192,168,41,2),9443);
}

void loop()
{
  Blynk.run();
}

the monitor output is:

[4480] Connecting to 192.168.41.2
[9480] Connecting to 192.168.41.2
[14481] Connecting to 192.168.41.2

also i did this without port number but the result is same:

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "*******";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*******";
char pass[] = "*****";

void setup()
{
  // Debug console
  Serial.begin(9600);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  Blynk.begin(auth, ssid, pass, IPAddress(192,168,41,2));
}

void loop()
{
  Blynk.run();
}

I would have thought port 80 or 8080 would have been required, but it depends how you’ve configured your local server.

Pete.

i also try it on 80 and 8080 port after ip address but i cannot connect to blynk localserver
i can creat acoount in blynk in local server and also i can that account in my user in local server but nodemcu cannot connect to localserver

Is your local server running?
Have you connected to it using the app and customer server setting.
Have you created a new project and added a device through the app?
Have you use the Auth code for that device in your sketch?
Are you server and device connected to the same network?

Pete.

yes.
yes blynk app can connect to local server cuz i created an account in blynk with local ip and it is registered in user of blynk local server.
yes.
yes.
yes local server is created in document folder in laptop and laptop connected to the same WIFI the nodemcu connect.
the problem is just nodemcu cannot connect to localserver.

What happens if you turn on debugging in your sketch, and what do the server logs show?

Pete.