Impossible to upload Blynk exemple sketch on arduino ESP32

Hello all, I'm a noob regarding Blynk so thank you in advance for your help!

I try to upload a sketch on my esp32.
The goal of the sketch is simple, I want to be able to read the state of the Blynk switch, start a pump and turn off the Blynk switch.

I tried to use the exemple on the Blynk website but my code won't even upload...
I tried to upload the sketch exemple ESP32_WIFI wich worked so the problem seem to be with the readingof the switch itself.

Here's the code of the code from the blynk website (That's not the code I want to use, I try to be at leat able to make a switch work for now):

#define BLYNK_PRINT Serial


#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "XXXXXXXXX";

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

// Select your pin with physical button
const int btnPin = 1;

WidgetLED led3(V3);

BlynkTimer timer;

// V3 LED Widget represents the physical button state
boolean btnState = false;
void buttonLedWidget()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin) == LOW);

  // If state has changed...
  if (isPressed != btnState) {
    if (isPressed) {
      led3.on();
    } else {
      led3.off();
    }
    btnState = isPressed;
  }
}

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

  Blynk.begin(auth, ssid, pass);
  // 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);

  // Setup physical button pin (active low)
  pinMode(btnPin, INPUT_PULLUP);

  timer.setInterval(500L, buttonLedWidget);
}

void loop()
{
  Blynk.run();
  timer.run();
}

Here's the code of the error:

Arduino:1.8.13 (Windows Store 1.8.42.0) (Windows 10), Carte : "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, None"

In file included from C:\Users\joell\OneDrive\Documents\Arduino\DOSSIER TEST\2021-03-18_test_blynk_esp32\2021-03-18_test_blynk_esp32.ino:6:0:

C:\Users\joell\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32.h: In member function 'void BlynkWifi::connectWiFi(const char*, const char*)':

C:\Users\joell\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32.h:37:14: error: 'class WiFiClass' has no member named 'mode'

         WiFi.mode(WIFI_STA);

              ^

C:\Users\joell\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32.h:37:19: error: 'WIFI_STA' was not declared in this scope

         WiFi.mode(WIFI_STA);

                   ^

C:\Users\joell\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32.h:39:34: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

             WiFi.begin(ssid, pass);

                                  ^

In file included from C:\Users\joell\OneDrive\Documents\Arduino\DOSSIER TEST\2021-03-18_test_blynk_esp32\2021-03-18_test_blynk_esp32.ino:4:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\WiFi\src/WiFi.h:79:9: note:   initializing argument 1 of 'int WiFiClass::begin(char*, const char*)'

     int begin(char* ssid, const char *passphrase);

         ^

In file included from C:\Users\joell\OneDrive\Documents\Arduino\DOSSIER TEST\2021-03-18_test_blynk_esp32\2021-03-18_test_blynk_esp32.ino:6:0:

C:\Users\joell\OneDrive\Documents\Arduino\libraries\Blynk\src/BlynkSimpleEsp32.h:41:28: error: invalid conversion from 'const char*' to 'char*' [-fpermissive]

             WiFi.begin(ssid);

                            ^

In file included from C:\Users\joell\OneDrive\Documents\Arduino\DOSSIER TEST\2021-03-18_test_blynk_esp32\2021-03-18_test_blynk_esp32.ino:4:0:

C:\Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.42.0_x86__mdqgnx93n4wtt\libraries\WiFi\src/WiFi.h:60:9: note:   initializing argument 1 of 'int WiFiClass::begin(char*)'

     int begin(char* ssid);

         ^

exit status 1

Erreur de compilation pour la carte ESP32 Dev Module



Ce rapport pourrait être plus détaillé avec
l'option "Afficher les résultats détaillés de la compilation"
activée dans Fichier -> Préférences.

I've been struggling on this for days now so, your help is very appreciated. Thank you!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.