Error loading sketch

Hello! buy this device
https://www.aliexpress.com/item/1PC-New-Arrival-WiFi-Bluetooth-Battery-ESP32-Development-Tool-Module-Board/32822939717.html?spm=a2g0s.9042311.0.0.6AlMcz
On the battery side read - wifi&Bluetoth battery.
Previously use wemos D1 mini. All working properly almost… but with new device not want to use blynk library. I read topic above and delete blynk library install new one from github, with the same result.
Looks like don’t want to use blynk lib…

**below I copy error message ---** 

Arduino: 1.8.4 (Windows 10), Board: ""WeMos" WiFi&Bluetooth Battery, 80MHz, 921600"

sketch_jan31a:29: error: 'WidgetLED' does not name a type

 WidgetLED led1(V0); //светодиод виджет на смарте подключен к V0

 ^

sketch_jan31a:50: error: expected constructor, destructor, or type conversion before ';' token

 BLYNK_CONNECTED() {

                   ^

sketch_jan31a:64: error: expected constructor, destructor, or type conversion before '(' token

 BLYNK_WRITE(V1) //считываем с кнопки V1 значение для реле 0

             ^

sketch_jan31a:85: error: expected constructor, destructor, or type conversion before '(' token

 BLYNK_WRITE(V6)  // считываем с регулятора V6 значение и записываем в переменную tset

             ^

C:\Users\User\Documents\Arduino\sketch_jan31a\sketch_jan31a.ino: In function 'void setup()':

sketch_jan31a:37: error: 'Blynk' was not declared in this scope

   Blynk.begin(auth, "Da4ka", "8914597DD");

   ^

C:\Users\User\Documents\Arduino\sketch_jan31a\sketch_jan31a.ino: At global scope:

sketch_jan31a:50: error: ISO C++ forbids declaration of 'BLYNK_CONNECTED' with no type [-fpermissive]

 BLYNK_CONNECTED() {

                 ^

C:\Users\User\Documents\Arduino\sketch_jan31a\sketch_jan31a.ino: In function 'int BLYNK_CONNECTED()':

sketch_jan31a:51: error: 'Blynk' was not declared in this scope

   Blynk.syncAll();

   ^

C:\Users\User\Documents\Arduino\sketch_jan31a\sketch_jan31a.ino: In function 'void sendOnOff()':

sketch_jan31a:55: error: 'STATUSD0' was not declared in this scope

   int x = digitalRead(STATUSD0);//читаем пин модуля наличие 220V

                       ^

sketch_jan31a:57: error: 'led1' was not declared in this scope

     led1.on(); //вкл вирт.светодиод

     ^

sketch_jan31a:60: error: 'led1' was not declared in this scope

     led1.off();

     ^

C:\Users\User\Documents\Arduino\sketch_jan31a\sketch_jan31a.ino: At global scope:

sketch_jan31a:64: error: expected constructor, destructor, or type conversion before '(' token

 BLYNK_WRITE(V1) //считываем с кнопки V1 значение для реле 0

            ^

C:\Users\User\Documents\Arduino\sketch_jan31a\sketch_jan31a.ino: In function 'void Send()':

sketch_jan31a:77: error: 'Blynk' was not declared in this scope

     Blynk.virtualWrite(V4, h);

     ^

sketch_jan31a:77: error: 'V4' was not declared in this scope

     Blynk.virtualWrite(V4, h);

                        ^

sketch_jan31a:78: error: 'V16' was not declared in this scope

     Blynk.virtualWrite(V16, hvn);

                        ^

sketch_jan31a:79: error: 'V3' was not declared in this scope

     Blynk.virtualWrite(V3, t);

                        ^

sketch_jan31a:80: error: 'V12' was not declared in this scope

     Blynk.virtualWrite(V12, tpr);

                        ^

sketch_jan31a:81: error: 'V14' was not declared in this scope

     Blynk.virtualWrite(V14, tobr);

                        ^

sketch_jan31a:82: error: 'V15' was not declared in this scope

     Blynk.virtualWrite(V15, tvn);

                        ^

C:\Users\User\Documents\Arduino\sketch_jan31a\sketch_jan31a.ino: At global scope:

sketch_jan31a:85: error: expected constructor, destructor, or type conversion before '(' token

 BLYNK_WRITE(V6)  // считываем с регулятора V6 значение и записываем в переменную tset

            ^

C:\Users\User\Documents\Arduino\sketch_jan31a\sketch_jan31a.ino: In function 'void loop()':

sketch_jan31a:109: error: 'Blynk' was not declared in this scope

   Blynk.run();

   ^

Multiple libraries were found for "WiFi.h"
 Used: D:\arduino-1.8.4\hardware\espressif\esp32\libraries\WiFi
 Not used: D:\arduino-1.8.4\libraries\WiFi
exit status 1
'WidgetLED' does not name a type

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Your error has nothing to do with the ESP… Basicly your code (which you didn’t show us) is all messed up :stuck_out_tongue_winking_eye:

Reinstall, if necessary, the latest Blynk Library…

Then start simple using the examples for ESP32 in the Sketch Builder and work up from there.

Hello Gunner, there is the code
As I talk - previously it was made for esp8266 and it was work. I buy new esp32 and try to use the code.

May be it mistake :slight_smile:

    #include <WiFi.h>
    #include <WiFiClient.h>
    #include <WiFiServer.h>
    #include <WiFiUdp.h>

    #include <DHT.h>
    #define STATUS15 15 // контролируемый пин модуля
    #define RELEON 0   //  реле ВКЛ на pin0 
    #define DHTPINpr 4 // DHT2 подключен к 4 температура прямой (выдачи) tpr
    #define DHTPIN 16 // DHT подключен к 16 
    #define DHTPINobr 17 // DHT2 подключен к 17 температура обратки tobr электрокотла
    #define DHTPINvn 5 // DHT2 подключен к 5 температура внешняя
    #define DHTTYPE DHT22   // DHT 22  (AM2302), AM2321
    #define BLYNK_PRINT Serial // Comment this out to disable prints and save space
    #include <SimpleTimer.h> //  таймер
    DHT dht(DHTPIN, DHT22);
    DHT dhtpr(DHTPINpr, DHT22);
    DHT dhtobr(DHTPINobr, DHT22);
    DHT dhtvn(DHTPINvn, DHT22);
    bool releon;
    int tset;
    float t;
    float h;
    float tpr; // прямая (выдача)
    float tobr; //обратка электрокотла
    float tvn; //внешняя t
    float hvn; //внешняя h

    WidgetLED led1(V0); //светодиод виджет на смарте подключен к V0
    SimpleTimer timer;

    char auth[] = "xxxxx";
    char ssid[] = "xxxxx";
    char pass[] = "xxxxx";

    void setup()
    {
      Serial.begin(57600);
      Blynk.begin(auth, ssid, pass);
      pinMode(RELEON, OUTPUT);
      pinMode(STATUS15, INPUT);
      digitalWrite(RELEON, LOW);
      digitalWrite(STATUS15, LOW);
      timer.setInterval(1000, sendOnOff);//устанавливаем перезапуск sendOnOff с интервалом 1с.
      timer.setInterval(2500, Send);//устанавливаем перезапуск Send с интервалом 2.5с.
      dht.begin();
      dhtpr.begin();
      dhtobr.begin();
      dhtvn.begin();
    }

    BLYNK_CONNECTED() {
      Blynk.syncAll();
    }

    void sendOnOff() {
      int x = digitalRead(STATUSD0);//читаем пин модуля наличие 220V
      if (x == 1) {//проверим состояние
        led1.on(); //вкл вирт.светодиод
      }
      else { //иначе выключим
        led1.off();
      }
    }

    BLYNK_WRITE(V1) //считываем с кнопки V1 значение для реле 0
    {
      releon = param.asInt();
    }

    void Send() {
      h = dht.readHumidity();
      hvn = dhtvn.readHumidity();
      t = dht.readTemperature(); // Read temperature as Celsius (the default)
      tpr = dhtpr.readTemperature(); // Read temperature as Celsius (the default)
      tobr = dhtobr.readTemperature(); // Read temperature as Celsius (the default)
      tvn = dhtvn.readTemperature(); // Read temperature as Celsius (the default)
      {
        Blynk.virtualWrite(V4, h);
        Blynk.virtualWrite(V16, hvn);
        Blynk.virtualWrite(V3, t);
        Blynk.virtualWrite(V12, tpr);
        Blynk.virtualWrite(V14, tobr);
        Blynk.virtualWrite(V15, tvn);
      }
    }
    BLYNK_WRITE(V6)  // считываем с регулятора V6 значение и записываем в переменную tset
    {
      tset = param.asInt();
        Blynk.virtualWrite(V5, tset); // записываем значение переменной tset в индикатор (V5)
    }

    void Tstat() {
      if (tset > t) //если t в помещении меньше чем установленая tset, и нужен нагрев
      {
        if (releon == true) // если нажата кнопка отопления
        {
          digitalWrite(RELEON, HIGH); //вкл нагрев
        }
        else
        {
          digitalWrite(RELEON, LOW); //если нет, то выключим
        }
      }
      else
      {
        digitalWrite(RELEON, LOW); //если нет, то выключим
      }
    }
    void loop() {
      Blynk.run();
      timer.run ();
      Send();
      Tstat();
    }

THANK YOU ALL!!! I unzip Blink v5.0 and do instructions
than I put #include <BlynkSimpleEsp32.h>, than ALL WORK!!!

1 Like

the Send call is just duplicated in the loop and in the timer - it should be removed from the loop, same applies for the Tstat call - it should be called by the timer, not in the loop.