My projects now cannot connect to the Blynk cloud

Hi, Blynkers.

My project supports 5 devices, which choosed using “Selector device” widget. Yesterday I refreshed authtocken on an first device.
After this my project cannot to connect to the Blynk cloud. Ping blynk-cloud.com is OK.
I did a new simple project Blinc Led and this project cannot to connect to the Blynk cloud.
Before changin authtocken all worked nice. What it can be?
May be connection to tthe cloud is blocked for my account?

Thank You.

Tere is my simple scatch:

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#define BLYNK_PRINT Serial 

const char* ssid = "qwe";
const char* pass = "asdfghj";
char auth[] = "XXXXXXXXXX";

WidgetLED led1(V1);
BlynkTimer timer;

// V1 LED Widget is blinking
void blinkLedWidget()
{
  if (led1.getValue()) 
  {
    led1.off();
    Serial.println("LED on V1: off");
  } 
  else 
  {
    led1.on();
    Serial.println("LED on V1: on");
  }
}

void setup()
{
  // Debug console
  Serial.begin(115200);
  // Connecting to WiFi network
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);
/*
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
*/
  Serial.println("Connecting to Blynk cloud");
  Blynk.begin(auth, ssid, pass);  //Blynk.config(auth);
  while (Blynk.connect() == false)
  {
    ; // Wait until connected
  }
 // isFirstConnect = true;
  Serial.print("Blynk.connect() = "); Serial.println(Blynk.connect());

  timer.setInterval(1000L, blinkLedWidget);
}

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

There is console output :slight_smile:

Connecting to qwe
Connecting to Blynk cloud

@klg Hello. Do you have latest app version? Some specific settings maybe? Did you manually put host/port within app settings?

I have Android app on smartphone 2.14.3, on Droid4X 2.18.1. Blynk library v0.5.0.

Some specific settings maybeЦитата

What do You mean?

Did you manually put host/port within app settings?

No .But if is needed then how and what I should setting up?

Please enable debug on hardware.

Please enable debug on hardware.

How I should to do this?

Dmitriy, I enabled debug hardware:
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG

but in console I see nothing exept:
Connecting to klg
Connecting to Blynk cloud
How You can see there are nothing messages about IP, port and other parameters.
Why?

Try setting baud rate to 74880 in your code and serial monitor.

Thanks zodiac, but this not helped.

Remove this for now and try again

I don’t think you are using it correctly anyhow… Blynk.connect() is a command that tries to connect… the command to check connection status is Blynk.connected()

Thanks, Gunner.
There is my code:

#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <DNSServer.h>
#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>

#define BLYNK_PRINT Serial 
#define BLYNK_DEBUG true

const char* ssid = "klg";
const char* pass = "klgklgklg";
char auth[] = "fe31f9320b444c29b3fcee2f37915dc1";

WidgetLED led1(V1);
BlynkTimer timer;

// V1 LED Widget is blinking
void blinkLedWidget()
{
  if (led1.getValue()) 
  {
    led1.off();
    Serial.println("LED on V1: off");
  } 
  else 
  {
    led1.on();
    Serial.println("LED on V1: on");
  }
}

void setup()
{
  // Debug console
  Serial.begin(9600);
  // Connecting to WiFi network
  Serial.println();
  Serial.print("Connecting to ");
  Serial.println(ssid);

  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED)
  {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi connected");
  Serial.println("Connecting to Blynk cloud");
  Blynk.config(auth);
  Serial.print("Blynk.connect() = "); Serial.println(Blynk.connected());

  timer.setInterval(1000L, blinkLedWidget);
}

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

There is output in an console:

WiFi connected
Connecting to Blynk cloud
Blynk.connect() = 0
LED on V1: on
LED on V1: off
LED on V1: on
LED on V1: off

How we can see in console there not nothing about connection to the Blynk cloud.

Try

Blynk.config(auth, "blynk-cloud.com", 8442);

Also, you don’t need true after this command… which is probably why you are not seeing any debug info…

I did what You suggested and got:

Connecting to klg
..
WiFi connected
Connecting to Blynk cloud
Blynk.connect() = 0
LED on V1: on
LED on V1: off

It’s same rezult…

Well, I don’t know… you are doing things a little differently then I do…

Blynk.connectWiFi(ssid, pass);
Blynk.config(auth, server, port);

but I guess as long as you are connecting to WiFi and the internet with your method, then it shouldn’t matter

And I am still not seeing any debug info… from #define BLYNK_DEBUG so I can’t tell what is happening.

Put Blynk.connect(); immediately after the Blynk.config(auth); in your sketch. If you don’t do this Blynk will try to connect once you hit Blynk.run() in the code and in such case calling Blynk.connected() earlier will give you wrong status.

Move #define BLYNK_PRINT Serial and #define BLYNK_DEBUG before the first #include.

1 Like

Thanks bilbobg.
I did all Your suggestions and got:

Connecting to klg
[75392] Connecting to klg
[78395] Connected to WiFi
[78395] IP: 192.168.1.228

WiFi connected
Connecting to Blynk cloud
[78395] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.5.0 on ESP8266

[78516] Connecting to blynk-cloud.com:8442
Blynk.connect() = 0
[92238] Connecting to blynk-cloud.com:8442
LED on V1: on
[106262] Connecting to blynk-cloud.com:8442
LED on V1: off
[120261] Connecting to blynk-cloud.com:8442
LED on V1: on

Debug messages apears now, but connection to the cloud no

No, now you are getting the normal Blynk messages… I think there should be a bit more with DEBUG

Looking for more confirmation of AUTH transmission and what, if any receiving info…

Like this

And are you confident that the device is getting internet connection, not just connecting to the WiFi?

Ping of blynk-cloud.com goes OK. So I think connection to the internet is OK es well. Isn’t it?

As long as you are running ping on something that is connected to the same WiFi, yes.

How about the rest of the serial monitor output with #define BLYNK_DEBUG ?