Blynk doesn't work with older ESP32 boards version

Hi, I’m trying to connect to blynk using the board manager for esp32 v2.0.17 (I can’t use newer versions because I want to implement the hallRead() function, which has been discontinued since) and it just won’t connect.

#define SECRET_SSID "xxx"
#define SECRET_PASS "xxx"
#define BLYNK_TEMPLATE_ID "..."
#define BLYNK_TEMPLATE_NAME "test"
#define BLYNK_AUTH_TOKEN "..."
#define PIN_SG90 18 

#include <WiFi.h>
#include <BlynkSimpleWifi.h>
#include <ESP32Servo.h>

char ssid[] = SECRET_SSID;
char pass[] = SECRET_PASS;

Servo sg90;

int zamykani = 0;
int hallvalue = 0;

void setup() {

  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);
  sg90.setPeriodHertz(50); 
  sg90.attach(PIN_SG90, 500, 2400); 
  Serial.begin(9600);

 }

void loop() {
Blynk.run();

if (zamykani == 0){
   sg90.write(180);
}else if (zamykani == 1) {
     sg90.write(90);
  }
}

BLYNK_WRITE(V0){
  zamykani = param.asInt();
}

What does your serial monitor show?

Have you tried a basic Blynk sketch compiled with your v2.x.x ESP32 core?

You also need to structure your code differently to clean-up your void loop. The only way that your zamykani variable can change is when the widget attached to V0 changes, so this code…

should be in BLYNK_WRITE(V0) rather than your void loop.

Pete.