I'm having compile error "no matching function.."

Whent I try to compile my sketch, IDE shows the following error:

no matching function for call to 'BlynkWifi::begin(char [33])'

I was working fine with my project, connected to Blynk without any issues. But now I included WifiManager to avoid the hardcoded of the SSID and Password and this error appeared.

I’m using ESP8266 NodeMCU Lolin standalone.

Any ideas?

My full code is here:

#define BLYNK_PRINT Serial 
#include <ESP8266WiFi.h>
#include <DNSServer.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <SoftwareSerial.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>         //https://github.com/tzapu/WiFiManager
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>
#define ONE_WIRE_BUS 2 // DS18B20 pin D4(ESP8266) compatible tarjeta antigua
#define GraphTemp 8
#define VIRTUAL_PIN_Terminal 9
#define VIRTUAL_PIN_Menu_Modo 26 
#define Update_Firmware 15 // Push Button virtual en Blynk para solicitar upgrade de Firmware OTA vía Http

const size_t len_curvas = 3858;
const uint8_t curvas[] PROGMEM = {----A very long binary data ---};
SimpleTimer timer;

WidgetRTC rtc;
WidgetTerminal terminal(VIRTUAL_PIN_Terminal); // Attach virtual serial terminal to Virtual Pin

OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);

float oldTemp = -1;
float temp;
int PWM_Digital_Canal[4] = { 5, 4, 0, 2};
int VIRTUAL_PIN_Fotoperiodo_Canal[4] = { 18, 19, 20, 21};
int Graph_Canal[4] = { 10, 11, 12, 14};
int PWM_Virtual_Canal[4] = { 0, 1, 2, 3};
int Luz[4];
int luz_anterior[4];
unsigned long deltaLuz[4];
int potCanal[4] = {0, 0, 0, 0};
int ValorLuzSD;
int modoLuz = 0;
unsigned long posmem;
int Modo = 1;
String Modo_txt[5] = {"Manual", "Despejado", "Nubes Suaves", "Nubes Intensas"};
char auth[] = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";   // My Token
int FotoPeriodo_Inicio_Canal[4] = { 300, 300, 300, 300};
int FotoPeriodo_Fin_Canal[4] = { 1320, 1320, 1320, 1320};
int Minuto_Ajustado;
const char* host = "esp8266-webupdate";
int updateWeb = 0;

ESP8266WebServer httpServer(80);
ESP8266HTTPUpdateServer httpUpdater;

void actualizaLuzTemp()
{
  int t = now(); // Guarda la hora actual en t
  String currentTime = String(hour()) + ":" + minute();
  int h = hour(t);  // returns the hour for the given time t
  int m = minute(t);// returns the minute for the given time t
  int i;
  switch (Modo)
  {
case 1:
for (i = 0; i < 4; i = i + 1) 
{
  potCanal[i] = Luz[i];
}
break;
default:
for (i = 0; i < 4; i = i + 1) 
{
  Minuto_Ajustado = ( h*60 + m - FotoPeriodo_Inicio_Canal[i]) * 642 / (FotoPeriodo_Fin_Canal[i] - FotoPeriodo_Inicio_Canal[i]);
  if ( Minuto_Ajustado < 0 || Minuto_Ajustado > 642 ) Minuto_Ajustado = 0;   
  posmem = (Modo-2)*1286 + (Minuto_Ajustado)*2;
  uint8_t byteval_1 = pgm_read_byte(curvas + posmem);
  posmem = posmem + 1;
  uint8_t byteval_2 = pgm_read_byte(curvas + posmem);
  if ( Luz[i] > 100) Luz[i] = 100;
  potCanal[i] = (byteval_1*256 + byteval_2)*Luz[i]/100;
}
if ( (luz_anterior[0] - potCanal[0]) * (luz_anterior[0] - potCanal[0]) >= 1601 )
{
  int i;
  for (i = 0; i < 4; i = i + 1) 
  {
    deltaLuz[i] = ( potCanal[i] - luz_anterior[i] ) / 50;
  }
  int Conteo_Segundos = 0;
  int millis_anterior = 0;
  int millis_actual = 0;
  terminal.println(F("-----------------"));
  terminal.println(F("* Partida Suave *"));
  terminal.println(F("-----------------"));
  terminal.flush();
  while (Conteo_Segundos < 50)
    {
      millis_actual = millis();
      yield();
      if ( (millis_actual - millis_anterior) > 1000 )
      {
        millis_anterior = millis_actual;
        Conteo_Segundos = Conteo_Segundos + 1;
        int i;
        for (i = 0; i < 4; i = i + 1) 
        {
          potCanal[i] = luz_anterior[i] + deltaLuz[i];
          analogWrite(PWM_Digital_Canal[i], potCanal[i]);
          luz_anterior[i] = potCanal[i];
        }
      }
    }    
}
break;
  }
  for (i = 0; i < 4; i = i+1 )
  {
analogWrite(PWM_Digital_Canal[i], potCanal[i]);
Blynk.virtualWrite(Graph_Canal[i], potCanal[i]);
luz_anterior[i] = potCanal[i];  
  }
  terminal.print("Hora: ");
  terminal.print(currentTime);
  leeTemperatura();
  Blynk.virtualWrite(GraphTemp, temp);
  terminal.println(" Temp. "+String( temp)+"°C ");
  terminal.println(F("-----------------"));
  terminal.println(Modo_txt[Modo]);
  for (i = 0; i < 4; i = i+1 )
  {
terminal.print("Canal ");
terminal.print(String(i+1));
terminal.print(": ");
terminal.println(String(potCanal[i]));
  }
  terminal.println(F("-----------------"));
  terminal.flush();
}

void leeTemperatura()
{
 //Captura el valor de Temperatura
   do {
DS18B20.requestTemperatures(); 
temp = DS18B20.getTempCByIndex(0);
 } 
  while (temp == 85.0 || temp == (-127.0));
if (temp != oldTemp)
{
   oldTemp = temp;
}
}

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
//Inicia conexión a Wifi, si no la encuentra, se convierte en AP y espera configuración ver https://github.com/tzapu/WiFiManager
  WiFiManager wifiManager; // Detección y configuración del AP
  wifiManager.autoConnect("Consola_Acuario","acuario2017"); // Nombre del AP ESP8266 y credencial de acceso
// Una vez conectado a WiFi inicia Blynk con el Token predefinido
  Blynk.begin(auth); //Una vez conectado a WiFi se conecta a Blynk
//Una vez conectado a Blynk notifica al terminal de la app
  terminal.println();
  terminal.println(F("Blynk v" BLYNK_VERSION));
  terminal.println(F("** Control Luz **"));
  terminal.println(F("-----------------"));
  terminal.flush();
//Inicializa el controlador y sus variables
  int i;
  for (i = 0; i < 4; i = i + 1) 
  {
  pinMode(PWM_Digital_Canal[i], OUTPUT);
  analogWrite(PWM_Digital_Canal[i], potCanal[i]);
  }
//
  actualizaLuzTemp();
  timer.setInterval(60000, actualizaLuzTemp);
  setSyncInterval(10*60); // Sync interval in seconds (10 minutes)
}

BLYNK_WRITE(VIRTUAL_PIN_Fotoperiodo_Canal[0]) // Lee limites de Fotoperiodo
{
TimeInputParam t(param);

// Procesa Inicio Fotoperiodo

if (t.hasStartTime())
  {
      FotoPeriodo_Inicio_Canal[0] = t.getStartHour() * 60 + t.getStartMinute();
  }
  else
  {
      FotoPeriodo_Inicio_Canal[0] = 300;
  }
  
// Procesa Término Fotoperiodo

if (t.hasStopTime())
  {
      FotoPeriodo_Fin_Canal[0] = t.getStopHour() * 60 + t.getStopMinute();
  }
else 
  {
    FotoPeriodo_Fin_Canal[0] = 1320;
  }
}

BLYNK_WRITE(VIRTUAL_PIN_Fotoperiodo_Canal[1]) // Lee limites de Fotoperiodo
{
TimeInputParam t(param);

// Procesa Inicio Fotoperiodo

if (t.hasStartTime())
  {
      FotoPeriodo_Inicio_Canal[1] = t.getStartHour() * 60 + t.getStartMinute();
  }
  else
  {
      FotoPeriodo_Inicio_Canal[1] = 300;
  }
  
// Procesa Término Fotoperiodo

if (t.hasStopTime())
  {
      FotoPeriodo_Fin_Canal[1] = t.getStopHour() * 60 + t.getStopMinute();
  }
else 
  {
    FotoPeriodo_Fin_Canal[1] = 1320;
  }
}

BLYNK_WRITE(VIRTUAL_PIN_Fotoperiodo_Canal[2]) // Lee limites de Fotoperiodo
{
TimeInputParam t(param);

// Procesa Inicio Fotoperiodo

if (t.hasStartTime())
  {
      FotoPeriodo_Inicio_Canal[2] = t.getStartHour() * 60 + t.getStartMinute();
  }
  else
  {
      FotoPeriodo_Inicio_Canal[2] = 300;
  }
  
// Procesa Término Fotoperiodo

if (t.hasStopTime())
  {
      FotoPeriodo_Fin_Canal[2] = t.getStopHour() * 60 + t.getStopMinute();
  }
else 
  {
    FotoPeriodo_Fin_Canal[2] = 1320;
  }
}

BLYNK_WRITE(VIRTUAL_PIN_Fotoperiodo_Canal[3]) // Lee limites de Fotoperiodo
{
TimeInputParam t(param);

// Procesa Inicio Fotoperiodo

if (t.hasStartTime())
  {
      FotoPeriodo_Inicio_Canal[3] = t.getStartHour() * 60 + t.getStartMinute();
  }
  else
  {
      FotoPeriodo_Inicio_Canal[3] = 300;
  }
  
// Procesa Término Fotoperiodo

if (t.hasStopTime())
  {
      FotoPeriodo_Fin_Canal[3] = t.getStopHour() * 60 + t.getStopMinute();
  }
else 
  {
    FotoPeriodo_Fin_Canal[3] = 1320;
  }
}

BLYNK_WRITE(PWM_Virtual_Canal[0]) //Slider Canal 1.  Esta funcion es llamada cada vez que se cambia el valor del slider Canal 1
{
  int pinData = param.asInt();
  if ( Modo == 1)
  {
analogWrite(PWM_Digital_Canal[0], pinData); 
  }  
  Luz[0] = pinData;
}

BLYNK_WRITE(PWM_Virtual_Canal[1]) //Slider Canal2.  Esta funcion es llamada cada vez que se cambia el valor del slider Canal 2
{
  int pinData = param.asInt();
  if ( Modo == 1)
  {
analogWrite(PWM_Digital_Canal[1], pinData); 
  }  
  Luz[1] = pinData;
}

BLYNK_WRITE(PWM_Virtual_Canal[2]) //Slider Canal 3.  Esta funcion es llamada cada vez que se cambia el valor del slider Canal 3
{
  int pinData = param.asInt();
  if ( Modo == 1)
  {
analogWrite(PWM_Digital_Canal[2], pinData); 
  }
  Luz[2] = pinData;
}

BLYNK_WRITE(PWM_Virtual_Canal[3]) //Slider Canal 4.  Esta funcion es llamada cada vez que se cambia el valor del slider Canal 4
{
  int pinData = param.asInt();
  if ( Modo == 1)
  {
analogWrite(PWM_Digital_Canal[3], pinData); 
  }
  Luz[3] = pinData;
}

BLYNK_WRITE(VIRTUAL_PIN_Menu_Modo) //Menu Modo. Esta función es llamada cada vez que se cambia el menu de Modo
{
  int pinData = param.asInt();
  Modo = pinData;
  switch (Modo) {
case 1:
  Blynk.setProperty(PWM_Virtual_Canal_1, "max", 1023);
  Blynk.setProperty(PWM_Virtual_Canal_2, "max", 1023);
  Blynk.setProperty(PWM_Virtual_Canal_3, "max", 1023);
  Blynk.setProperty(PWM_Virtual_Canal_4, "max", 1023);
  break;
default: 
  Blynk.setProperty(PWM_Virtual_Canal_1, "max", 100);
  Blynk.setProperty(PWM_Virtual_Canal_2, "max", 100);
  Blynk.setProperty(PWM_Virtual_Canal_3, "max", 100);
  Blynk.setProperty(PWM_Virtual_Canal_4, "max", 100);  
break;
  }
}

BLYNK_WRITE(Update_Firmware) // Activa Busqueda y ejecución de actualización de firmware
{
int pinData = param.asInt();
updateWeb = pinData;
if ( updateWeb == 1 )
{
   terminal.println(F("*********************"));
   terminal.println(F("Inicia Actualización"));
   terminal.println(F("Dispositivo"));
   terminal.print("MAC: ");
   terminal.println(WiFi.macAddress());
   terminal.println(F("Debe estar conectado a la misma red wifi del controlador."));
   terminal.println(F("Abra el siguiente enlace y luego seleccione el archivo y presione UPDATE"));
   terminal.print("http://");
   terminal.print( WiFi.localIP());
   terminal.print("/update");
   terminal.flush();
   Blynk.disconnect();
   MDNS.begin(host);
   httpUpdater.setup(&httpServer);
   httpServer.begin();
   MDNS.addService("http", "tcp", 80);
 } 
}


BLYNK_CONNECTED() {
  // Synchronize time on connection
  rtc.begin();
  Blynk.syncAll();
  terminal.println(F("-----------------"));
  terminal.println(F("*Blynk Connected*"));
  terminal.println(F("-----------------"));
  terminal.flush();
}

void loop()
{
  Blynk.run();
  timer.run();
  if ( updateWeb == 1 )
  {
httpServer.handleClient();
  }
}

You don’t use Blynk.begin() with WiFi Manager it is Blynk.config() and Blynk.connect().

Thanks @Costas, I edited:

  Blynk.config(auth); //Una vez conectado a WiFi se conecta a Blynk
  Blynk.connect(); 

And compiled again. Solved this! Thanks!!.

But now the error changed to:

expected primary-expression before 't’

Nextion_ESP_V14:230: error: expected declaration before '}' token

 }

 ^

exit status 1
expected primary-expression before 't'

On this part of the sketch:

BLYNK_WRITE(VIRTUAL_PIN_Fotoperiodo_Canal[0]) // Lee limites de Fotoperiodo
{
    TimeInputParam t(param);

    // Procesa Inicio Fotoperiodo

    if (t.hasStartTime())
      {
          FotoPeriodo_Inicio_Canal[0] = t.getStartHour() * 60 + t.getStartMinute();
      }
      else
      {
          FotoPeriodo_Inicio_Canal[0] = 300;
      }
  
    // Procesa Término Fotoperiodo

    if (t.hasStopTime())
      {
          FotoPeriodo_Fin_Canal[0] = t.getStopHour() * 60 + t.getStopMinute();
      }
    else 
      {
        FotoPeriodo_Fin_Canal[0] = 1320;
      }
}

I have to say I have almost the same code working on ESP8266, with the difference that now I’m using arrays.

You can’t define virtual pin arrays like that and I’m not sure what the correct procedure is. What you can do is this if it helps:

BLYNK_WRITE_DEFAULT()       // this is OK and covers the default for any virtual pins that are not covered by a specific BLYNK_WRITE()
{
  TimeInputParam t(param);
  // Procesa Inicio Fotoperiodo
  if (t.hasStartTime())
    {
        FotoPeriodo_Inicio_Canal[0] = t.getStartHour() * 60 + t.getStartMinute();
    }
    else
    {
        FotoPeriodo_Inicio_Canal[0] = 300;
    } 
  // Procesa Término Fotoperiodo
  if (t.hasStopTime())
    {
        FotoPeriodo_Fin_Canal[0] = t.getStopHour() * 60 + t.getStopMinute();
    }
  else 
    {
      FotoPeriodo_Fin_Canal[0] = 1320;
    }
}

Thanks @Costas, I finally decided to hardcode the Virtual pins.

hi!

please do not forget to change the topic category to “solved” if you are happy with the solution. it keeps the place more organised and helps other users to quickly see the state of the topic.

thanks!

Thanks for the reminder