Blynk.config not working

hello,

This i my code

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

char auth[] = "**********************************";
char ssid[] = "PTCL-BB";
char pass[] = "3553C8A8";



#define ESP8266_BAUD 115200
ESP8266 wifi(&Serial);



int LED1 = 13; 
int LED2 = 24;
int LED3 = 36;
int LED4 = 44;

void setup()
{
 // Debug console
 Serial.begin(9600);
 delay(20);

 Serial.begin(ESP8266_BAUD);
 delay(20);

 Blynk.config(auth, wifi, ssid, pass)

 
 pinMode(LED1, OUTPUT);
 pinMode(LED2, OUTPUT);
 pinMode(LED3, OUTPUT);
 pinMode(LED4, OUTPUT);
 
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, HIGH);
digitalWrite(LED4, HIGH);
}
void loop()
{
 Blynk.run();
} 

BLYNK_WRITE(V1) {
 int pinValue = param.asInt();
 if (pinValue == 1) {
    digitalWrite(LED1, HIGH);
  } else {
    digitalWrite(LED1, LOW);
 }
}


BLYNK_WRITE(V2) {
 int pinValue = param.asInt();
 if (pinValue == 1) {
    digitalWrite(LED2, HIGH);
  } else {
    digitalWrite(LED2, LOW);
 }
}


BLYNK_WRITE(V3) {
 int pinValue = param.asInt();
 if (pinValue == 1) {
    digitalWrite(LED3, HIGH);
  } else {
    digitalWrite(LED3, LOW);
 }
}



BLYNK_WRITE(V4) {
 int pinValue = param.asInt(); 
 if (pinValue == 1) {
    digitalWrite(LED4, HIGH);
  } else {
    digitalWrite(LED4, LOW);
 }
}

the blynk.config is not working. giving this error;
no matching function for call to ‘BlynkWifi::config(char [33], ESP8266&, char [8], char [9])’

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

no matching function for call to ‘BlynkWifi::config(char [33], int&, int&)’

still giving this error

I have attached esp8266 to arduino nano,

and i want my program to run without INTERNET and reconnect to the blynk when Internet is available

what release of esp8266 core are you using ?

https://hallroad.org/esp-01-esp8266-wifi-module-in-pakistan.html
this one

I was talking about ESP8266 Arduino Core master from github. :wink:

Hello,

I have two pieces of code one is with Blynk.begin. Which is working and esp8266 is getting connect to the server.
Connections are the same.
while the other is with blynk.config which is stuck in errors

Code 1

#define BLYNK_PRINT Serial
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>

 
char auth[] = "*******************************************";
char ssid[] = "PTCL-BB";
char pass[] = "3553C8A8";
#define ESP8266_BAUD 115200
ESP8266 wifi(&Serial);



int server , port;

void setup()
{

 // Debug console
 Serial.begin(9600);
 delay(10);
 // Set ESP8266 baud rate
 Serial.begin(ESP8266_BAUD);
 delay(10);


     Blynk.begin(auth, wifi, ssid, pass);

 
 pinMode(13, OUTPUT);
 pinMode(6, OUTPUT);
 pinMode(7, OUTPUT);
 
 pinMode(9, INPUT);
 pinMode(10, INPUT);
 

 digitalWrite(6, HIGH);
 digitalWrite(7, HIGH);


}
void loop()
{
  Serial.println("Hello this is before ");
 Blynk.run();


} 

BLYNK_WRITE(V1) {
 int pinValue = param.asInt(); // Assigning incoming value from pin V3 to a variable
 if (pinValue == 1) {
    digitalWrite(13, HIGH); // Turn LED on.
    Blynk.virtualWrite(V6, 255);

  } else {
    digitalWrite(13, LOW); // Turn LED off.
    Blynk.virtualWrite(V6, 0);

 }
}

Code 2

  #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
    #include <BlynkSimpleShieldEsp8266.h>
    #include <SimpleTimer.h>
    #include "WiFiEsp.h"
    char auth[] = "*******************************************";
    char ssid[] = "PTCL-BB";
    char pass[] = "3553C8A8";

    bool Connected2Blynk = false;
    int x = 10001;
    #define ESP8266_BAUD 115200
    ESP8266 wifi(&Serial);

    SimpleTimer timer;
    int blynkConnStat;

    void setup()
    {
      Serial.begin(115200);
      delay(100);
      // Set ESP8266 baud rate
      Serial.begin(ESP8266_BAUD);
      delay(100);

      Blynk.config(wifi,auth);
      




    }

    void loop()
    {
      Serial.println ("hello");


      if (blynkConnStat == 0 ){
        Serial.print("Blynk connecting");
        Blynk.connect();
           Blynk.run();
        blynkConnStat = Blynk.connected();
      x=0;
      }
      
      x++;
       Blynk.run();
       Serial.print(blynkConnStat);
    }

this one keeps giving this messege

AT+CIPCLOSE=1
AT+CIPSTART=1,“TCP”,“blynk-cloud.com”,80
AT+CIPCLOSE=1
AT+CIPSTART=1,“TCP”,“blynk-cloud.com”,80
AT+CIPCLOSE=1
AT+CIPSTART=1,“TCP”,“blynk-cloud.com”,80

Hello is there no one to help ?

Perhaps if you didn’t jump to another new topic instead of working with the help you were getting here :stuck_out_tongue:

I merged your topics back together, please keep your issue in the same topic.

If you read the directions closer… you would see that, unlike Blynk.begin()Blynk.config() is just for Blynk setup… you MUST have previously setup your own network connection with whatever hardware you are using.

Thank you Man You ARe The Best.

And sorry I thought these are maybe a little different posts so posted another.
But thanks again. And hats off to your services…

FYI, one of the primary reasoning for using Blynk.config() is to allow your code to start and run, even if there is no connection to Blynk’s Server currently available… assuming you need and code it that way of course.

Otherwise if using Blynk.begin() it will never move past that command until a successful connection is made.

Yes, I just thought that blynk.connect() will make the connection but now I am using Blynk.connectWiFi(ssid, pass);
And this is working just fine . but thanks to you for that .

Nope… that is all done with Blynk.begin()

With Blynk.config() it is a multi stage process…

  • Setup and connect to internet/network - options like Blynk.connectWiFi() or WiFi.begin(), etc…

  • Setup Blynk connection - Blynk.config()

  • Connect to Blynk’s server over internet/network, if available - Blynk.connect()

  • Run code, regardless of server connection or not

  • Attempt server reconnection if required - Blynk.connect()

3 Likes