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

Automatic reconnect to wifi and Blynk - compilation issues

esp8266
#1

Hi,

I am using Arduino Mega (Arduino Version 1.8.9) and ESP8266 as wifi shield. Blynk is set up to read temperature measurements and also to take inputs which actuate servo valves. I have the ESP8266 core installed and libraries Blynk Library Master

Everything is working fine with the exception that the wifi connection will at times break down and I need get the arduino to automatically reconnect to wifi and Blynk. I read what I could find and believe to understand how to use " Blynk.connectWifi(ssid, pass);" and “Blynk.config(auth);” in the loop function to accomplish that.

My issue is the code does not even compile. It throws errors on the “Blynk.wifi” command such as error: ‘class BlynkWifi’ has no member named ‘connectWifi’ - as if it cannot find the correct library. However I do not see which library is missing. Feels to me as if I am overlooking sth obvious… Thanks for your help. Code and full error log below.

// BLYNK 

#include <ESP8266_Lib.h>     // download https://github.com/blynkkk/blynk-library 
#include <BlynkSimpleShieldEsp8266.h>  // download https://github.com/blynkkk/blynk-library
#include <SimpleTimer.h>  // download https://github.com/jfturcot/SimpleTimer

#define BLYNK_PRINT Serial 
#define EspSerial Serial1
#define ESP8266_BAUD 115200

ESP8266 wifi(&EspSerial);

BlynkTimer timer;

void setup();

// Set ESP8266 baud rate
EspSerial.begin(ESP8266_BAUD);
delay(10);

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

timer.setInterval(2000L, myTimerEvent);


void loop() {

if (Blynk.connected()) {  
  Blynk.run();  
  }
  else {
  Blynk.connectWifi(ssid, pass);
  if (WiFi.status() == WL_CONNECTED){
        Blynk.config(auth);
        Blynk.connect();  
    }    
  }

 timer.run(); 

}

Compilation Error:

Arduino: 1.8.9 (Windows 10), Board: “Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)”

\united.domain\homes\Karlsruhe\msteinberg\Eigene Dateien\21 Privat\02 Brewing\CloudBrewery2018_v27\CloudBrewery2018_v27.ino: In function ‘void loop()’:

CloudBrewery2018_v27:586:9: error: ‘class BlynkWifi’ has no member named ‘connectWifi’

Blynk.connectWifi(ssid, pass);

     ^

CloudBrewery2018_v27:587:7: error: ‘WiFi’ was not declared in this scope

if (WiFi.status() == WL_CONNECTED){

   ^

CloudBrewery2018_v27:587:24: error: ‘WL_CONNECTED’ was not declared in this scope

if (WiFi.status() == WL_CONNECTED){

                    ^

CloudBrewery2018_v27:588:26: error: no matching function for call to ‘BlynkWifi::config(char [33])’

     Blynk.config(auth);

                      ^

In file included from \united.domain\homes\Karlsruhe\msteinberg\Eigene Dateien\21 Privat\02 Brewing\CloudBrewery2018_v27\CloudBrewery2018_v27.ino:329:0:

\united.domain\homes\Karlsruhe\msteinberg\Eigene Dateien\21 Privat\03 Arduino\arduino-1.8.9\libraries\BlynkESP8266_Lib/BlynkSimpleShieldEsp8266.h:169:10: note: candidate: void BlynkWifi::config(ESP8266&, const char*, const char*, uint16_t)

 void config(ESP8266&    esp8266,

      ^

\united.domain\homes\Karlsruhe\msteinberg\Eigene Dateien\21 Privat\03 Arduino\arduino-1.8.9\libraries\BlynkESP8266_Lib/BlynkSimpleShieldEsp8266.h:169:10: note: candidate expects 4 arguments, 1 provided

exit status 1
‘class BlynkWifi’ has no member named ‘connectWifi’

0 Likes

#2

take a look at this example.

0 Likes