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

Nodemcu does not connect to my local server

esp8266

#1

I run this simple code and blynk connects to my router but fails to connect to the local server running on my pi2b. This is the simple code i ran.

#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[] = "55ffh7f509b4485fa2370bbas67899";

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

void setup()
{
  // Debug console
  Serial.begin(115200);

  //Blynk.begin(auth, ssid, pass);
  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Serial.print ( "connecting to local server" ) ;
  Blynk.begin(auth, ssid, pass, IPAddress(10,42,0,1), 8080);
}

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

This is the serial output

connected with CIRCOS, channel 1
    dhcp client start...
    ip:10.42.0.206,mask:255.255.255.0,gw:10.42.0.1
    [4367] Connected to WiFi
    [4367] IP: 10.42.0.206
    [4367] 
        ___  __          __
       / _ )/ /_ _____  / /__
      / _  / / // / _ \/  '_/
     /____/_/\_, /_//_/_/\_\
            /___/ v0.5.4 on NodeMCU

[4373] Connecting to 10.42.0.247
[7521] Login timeout
[9521] Connecting to 10.42.0.247
[13205] Login timeout
pm open,type:2 0
[15205] Connecting to 10.42.0.247
[20206] Connecting to 10.42.0.247

#2

Why is it trying to connect to a different IP then what you programmed??

Try this way… assuming this is the correct IP for your server… 1 is usually used by the router.

Blynk.begin(auth, ssid, pass, "10.42.0.1", 8080);


#3

As evidenced here…