BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Cannot successfully connect to blynk-cloud.com

Hi,

Just can’t seen to get a successful connection & auth to blynk-cloud.com.
Hardware is a D1 Mini based on 8266, wifi on my local network connected through broadband provider, Latest Blynk Libraries.
As you can see via the code I’ve tried a few different connection options. Connecting wifi via Blynk.connectWiFi I can see I successfully get wifi connected and see a valid IP, but then Blynk.connect is not successful.
Using Blynk.begin just appears to hang and not progress any further with the code.
I’ve tried ports 8080 and 80, with no success

I can successfully ping blynk-cloud.com. telnet blynk-cloud.com 80 appears to connect OK but I only get a blank screen and flashing cursor at the terminal so I’m not 100% sure that is the behaviour that is expected.

All help appreciated.

#include "SM Header"
#include <ESP8266WiFi.h>

#define BLYNK_TEMPLATE_ID "aaaa"
#define BLYNK_DEVICE_NAME "SmokeyMon"
#define BLYNK_AUTH_TOKEN "bbbbbbbb"
char auth[] = "bbbbbbbb";

// DEBUG.

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

int heatcontrolman; // On Off state of Heat Controll Manual Button

// NodeMCU Pin assigment
int gassolenoid = D4;

/* Blynk app Virtual pin numbers
V4 Heat Conntrol Manual Button
*/

BLYNK_WRITE(V4)
{
  heatcontrolman = param.asInt();}

void setup()
{

  // Debug console
  Serial.begin(9600);
  Serial.println("Sandwich");
  Serial.println("Sandwich");
  Serial.println(ssid);
  Serial.println("Auth");
  Blynk.connectWiFi(ssid, pass);
  Serial.println("pass");
  Serial.println(auth);
  Blynk.config(auth, "blynk-cloud.com", 8080);
  Blynk.disconnect();

  // Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);

  // You can also specify server:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
  //Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);

  if (WiFi.status() == WL_CONNECTED) {
    Serial.println("WiFi connected OK");
  }
  Serial.println(ssid);
  Serial.println("IP Address: ");
  Serial.println(WiFi.localIP());

  Blynk.connect();
  if (Blynk.connected()) {
    Serial.println("Blynk connect TRUE");
  }
    pinMode(gassolenoid, OUTPUT);
    Serial.println("Main Loop");
}

void loop()
{
  Blynk.run();
  if (heatcontrolman==0){
    gassolenoid = 0;}
    else
    {if (heatcontrolman==1){
      gassolenoid = 1;}
    }
    if (Blynk.connected()) {
      Serial.println("Blynk connect TRUE");
    }
}

blynk-cloud.com is the URL for the Legacy cloud servers.

The URL for the Blynk IoT servers is blynk.cloud

Pete.

also,

Must be the first two lines in your sketch.

and you should read this
https://docs.blynk.io/en/legacy-platform/legacy-articles/keep-your-void-loop-clean

Pete, stupid I forgot referencing legacy code, blynk.cloud, thankyou very much for that.

And John, I’ll keep an eye on delays and timing, thankyou also for that.

All good now.

1 Like