LED status indicator does not work

My status indicator is not working. Have virtual pins. How or what exactly should I enter in the sketch?
Instead of
const int pinValue1 = 0;
I had already
const int addr1Pin1 = 0;
and so too

boolean addr1State1 = false;
void buttonLedWidget1 ()
{
// read button
boolean isPressed = (digitalRead (addr1Pin1) == LOW);

// If state has changed …
if (isPressed! = addr1State1) {
if (isPressed) {
led1.on ();
} else {
led1.off ();
}
addr1State1 = isPressed;
}
registered, unfortunately without success. Could you please give me an example for an LED? thanks

PS: switching the relay works great thanks to their help.

It is remarkable that the LED7 lights up although relay 7 is off. At intervals of about 15 sec. LED 8 lights up briefly, then goes off again. Relays were not turned on.

Here is a little video about it https://youtu.be/V6whKBEsz_k

Here is a little video about it. When button 1 is pressed, status 8 and 16 go on and status 15 goes off and on again for a short time. Also when pressing the button 4, it is similar. Very strange the whole. Could you please help me? thanks

#define BLYNK_PRINT Serial
#include <PCF8574.h> 
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Wire.h>
#define SDA_PIN 21 //GPIO21 on ESP32
#define SCL_PIN 22 //GPIO22 on ESP32

PCF8574 addr1 (0x20);          // PCF8574 device (addr1) 1 ACHTUNG! Adresse 0x20 einstellen A0>0,A1>0,A2>0 Port-Bereich P0-P8 (addr Namen kann man frei wählen)
PCF8574 addr2 (0x21);          // PCF8574 device (addr2) 2 ACHTUNG! Adresse 0x21 einstellen A0>1,A1>0,A2>0 Port-Bereich P0-P8
PCF8574 addr3 (0x22);          // PCF8574 device (addr3) 3 ACHTUNG! Adresse 0x22 einstellen A0>0,A1>1,A2>0 Port-Bereich P0-P8
PCF8574 addr4 (0x23);          // PCF8574 device (addr4) 4 ACHTUNG! Adresse 0x23 einstellen A0>1,A1>1,A2>0 Port-Bereich P0-P8
//PCF8574 addr5 (0x24);        // PCF8574 device (addr5) 5 ACHTUNG! Adresse 0x24 einstellen A0>0,A1>0,A2>1 Port-Bereich P0-P8
//PCF8574 addr6 (0x25);        // PCF8574 device (addr6) 6 ACHTUNG! Adresse 0x25 einstellen A0>1,A1>0,A2>1 Port-Bereich P0-P8
//PCF8574 addr7 (0x26);        // PCF8574 device (addr7) 7 ACHTUNG! Adresse 0x26 einstellen A0>0,A1>1,A2>1 Port-Bereich P0-P8
//PCF8574 addr8 (0x27);        // PCF8574 device (addr8) 8 ACHTUNG! Adresse 0x27 einstellen A0>1,A1>1,A2>1 Port-Bereich P0-P8


char auth[] = "xxxxxxxxxx";

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

const int pinValue1 = 0;
const int pinValue2 = 1;
const int pinValue3 = 2;
const int pinValue4 = 3;
const int pinValue5 = 4;
const int pinValue6 = 5;
const int pinValue7 = 6;
const int pinValue8 = 7;
const int pinValue9 = 0;
const int pinValue10 = 1;
const int pinValue11 = 2;
const int pinValue12 = 3;
const int pinValue13 = 4;
const int pinValue14 = 5;
const int pinValue15 = 6;
const int pinValue16 = 7;
const int pinValue17 = 0;
const int pinValue18 = 1;
const int pinValue19 = 2;
const int pinValue20 = 3;
const int pinValue21 = 4;
const int pinValue22 = 5;
const int pinValue23 = 6;
const int pinValue24 = 7;
const int pinValue25 = 0;
const int pinValue26 = 1;
const int pinValue27 = 2;
const int pinValue28 = 3;
const int pinValue29 = 4;
const int pinValue30 = 5;
const int pinValue31 = 6;
const int pinValue32 = 7;


WidgetLED led1(V33);
WidgetLED led2(V34);
WidgetLED led3(V35);
WidgetLED led4(V36);
WidgetLED led5(V37);
WidgetLED led6(V38);
WidgetLED led7(V39);
WidgetLED led8(V40);
WidgetLED led9(V41);
WidgetLED led10(V42);
WidgetLED led11(V43);
WidgetLED led12(V44);
WidgetLED led13(V45);
WidgetLED led14(V46);
WidgetLED led15(V47);
WidgetLED led16(V48);
WidgetLED led17(V49);
WidgetLED led18(V50);
WidgetLED led19(V51);
WidgetLED led20(V52);
WidgetLED led21(V53);
WidgetLED led22(V54);
WidgetLED led23(V55);
WidgetLED led24(V56);
WidgetLED led25(V57);
WidgetLED led26(V58);
WidgetLED led27(V59);
WidgetLED led28(V60);
WidgetLED led29(V61);
WidgetLED led30(V62);
WidgetLED led31(V63);
WidgetLED led32(V64);

BlynkTimer timer;


boolean pinValue1State1 = false;
void buttonLedWidget1()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue1) == LOW);

  // If state has changed...
  if (isPressed != pinValue1State1) {
    if (isPressed) {
      led1.on();
    } else {
      led1.off();
    }
    pinValue1State1 = isPressed;
  }
}
boolean pinValue2State2 = false;
void buttonLedWidget2()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue2) == LOW);

  // If state has changed...
  if (isPressed != pinValue2State2) {
    if (isPressed) {
      led2.on();
    } else {
      led2.off();
    }
    pinValue2State2 = isPressed;
  }
}
boolean pinValue3State3 = false;
void buttonLedWidget3()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue3) == LOW);

  // If state has changed...
  if (isPressed != pinValue3State3) {
    if (isPressed) {
      led3.on();
    } else {
      led3.off();
    }
    pinValue3State3 = isPressed;
  }
}
boolean pinValue4State4 = false;
void buttonLedWidget4()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue1) == LOW);

  // If state has changed...
  if (isPressed != pinValue4State4) {
    if (isPressed) {
      led4.on();
    } else {
      led4.off();
    }
    pinValue4State4 = isPressed;
  }
}
boolean pinValue5State5 = false;
void buttonLedWidget5()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue5) == LOW);

  // If state has changed...
  if (isPressed != pinValue5State5) {
    if (isPressed) {
      led5.on();
    } else {
      led5.off();
    }
    pinValue5State5 = isPressed;
  }
}
boolean pinValue6State6 = false;
void buttonLedWidget6()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue6) == LOW);

  // If state has changed...
  if (isPressed != pinValue6State6) {
    if (isPressed) {
      led6.on();
    } else {
      led6.off();
    }
    pinValue6State6 = isPressed;
  }
}
boolean pinValue7State7 = false;
void buttonLedWidget7()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue7) == LOW);

  // If state has changed...
  if (isPressed != pinValue7State7) {
    if (isPressed) {
      led7.on();
    } else {
      led7.off();
    }
    pinValue7State7 = isPressed;
  }
}
boolean pinValue8State8 = false;
void buttonLedWidget8()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue8) == LOW);

  // If state has changed...
  if (isPressed != pinValue8State8) {
    if (isPressed) {
      led8.on();
    } else {
      led8.off();
    }
    pinValue8State8 = isPressed;
  }
}
boolean pinValue9State9 = false;
void buttonLedWidget9()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue9) == LOW);

  // If state has changed...
  if (isPressed != pinValue9State9) {
    if (isPressed) {
      led9.on();
    } else {
      led9.off();
    }
    pinValue9State9 = isPressed;
  }
}
boolean pinValue10State10 = false;
void buttonLedWidget10()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue10) == LOW);

  // If state has changed...
  if (isPressed != pinValue10State10) {
    if (isPressed) {
      led10.on();
    } else {
      led10.off();
    }
    pinValue10State10 = isPressed;
  }
}
boolean pinValue11State11 = false;
void buttonLedWidget11()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue11) == LOW);

  // If state has changed...
  if (isPressed != pinValue11State11) {
    if (isPressed) {
      led11.on();
    } else {
      led11.off();
    }
    pinValue11State11 = isPressed;
  }
}
boolean pinValue12State12 = false;
void buttonLedWidget12()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue12) == LOW);

  // If state has changed...
  if (isPressed != pinValue12State12) {
    if (isPressed) {
      led12.on();
    } else {
      led12.off();
    }
    pinValue12State12 = isPressed;
  }
}
boolean pinValue13State13 = false;
void buttonLedWidget13()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue13) == LOW);

  // If state has changed...
  if (isPressed != pinValue13State13) {
    if (isPressed) {
      led13.on();
    } else {
      led13.off();
    }
    pinValue13State13 = isPressed;
  }
}
boolean pinValue14State14 = false;
void buttonLedWidget14()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue14) == LOW);

  // If state has changed...
  if (isPressed != pinValue14State14) {
    if (isPressed) {
      led14.on();
    } else {
      led14.off();
    }
    pinValue14State14 = isPressed;
  }
}
boolean pinValue15State15 = false;
void buttonLedWidget15()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue15) == LOW);

  // If state has changed...
  if (isPressed != pinValue15State15) {
    if (isPressed) {
      led15.on();
    } else {
      led15.off();
    }
    pinValue15State15 = isPressed;
  }
}
boolean pinValue16State16 = false;
void buttonLedWidget16()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue16) == LOW);

  // If state has changed...
  if (isPressed != pinValue16State16) {
    if (isPressed) {
      led16.on();
    } else {
      led16.off();
    }
    pinValue16State16 = isPressed;
  }
}
boolean pinValue17State17 = false;
void buttonLedWidget17()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue17) == LOW);

  // If state has changed...
  if (isPressed != pinValue17State17) {
    if (isPressed) {
      led17.on();
    } else {
      led17.off();
    }
    pinValue17State17 = isPressed;
  }
}
boolean pinValue18State18 = false;
void buttonLedWidget18()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue18) == LOW);

  // If state has changed...
  if (isPressed != pinValue18State18) {
    if (isPressed) {
      led18.on();
    } else {
      led18.off();
    }
    pinValue18State18 = isPressed;
  }
}
boolean pinValue19State19 = false;
void buttonLedWidget19()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue19) == LOW);

  // If state has changed...
  if (isPressed != pinValue19State19) {
    if (isPressed) {
      led19.on();
    } else {
      led19.off();
    }
    pinValue19State19 = isPressed;
  }
}
boolean pinValue20State20 = false;
void buttonLedWidget20()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue20) == LOW);

  // If state has changed...
  if (isPressed != pinValue20State20) {
    if (isPressed) {
      led20.on();
    } else {
      led20.off();
    }
    pinValue20State20 = isPressed;
  }
}
boolean pinValue21State21 = false;
void buttonLedWidget21()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue21) == LOW);

  // If state has changed...
  if (isPressed != pinValue21State21) {
    if (isPressed) {
      led21.on();
    } else {
      led21.off();
    }
    pinValue21State21 = isPressed;
  }
}
boolean pinValue22State22 = false;
void buttonLedWidget22()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue22) == LOW);

  // If state has changed...
  if (isPressed != pinValue22State22) {
    if (isPressed) {
      led22.on();
    } else {
      led22.off();
    }
    pinValue22State22 = isPressed;
  }
}
boolean pinValue23State23 = false;
void buttonLedWidget23()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue23) == LOW);

  // If state has changed...
  if (isPressed != pinValue23State23) {
    if (isPressed) {
      led23.on();
    } else {
      led23.off();
    }
    pinValue23State23 = isPressed;
  }
}
boolean pinValue24State24 = false;
void buttonLedWidget24()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue24) == LOW);

  // If state has changed...
  if (isPressed != pinValue24State24) {
    if (isPressed) {
      led24.on();
    } else {
      led24.off();
    }
    pinValue24State24 = isPressed;
  }
}
boolean pinValue25State25 = false;
void buttonLedWidget25()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue25) == LOW);

  // If state has changed...
  if (isPressed != pinValue25State25) {
    if (isPressed) {
      led25.on();
    } else {
      led25.off();
    }
    pinValue25State25 = isPressed;
  }
}
boolean pinValue26State26 = false;
void buttonLedWidget26()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue26) == LOW);

  // If state has changed...
  if (isPressed != pinValue26State26) {
    if (isPressed) {
      led26.on();
    } else {
      led26.off();
    }
    pinValue26State26 = isPressed;
  }
}
boolean pinValue27State27 = false;
void buttonLedWidget27()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue27) == LOW);

  // If state has changed...
  if (isPressed != pinValue27State27) {
    if (isPressed) {
      led27.on();
    } else {
      led27.off();
    }
    pinValue27State27 = isPressed;
  }
}
boolean pinValue28State28 = false;
void buttonLedWidget28()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue28) == LOW);

  // If state has changed...
  if (isPressed != pinValue28State28) {
    if (isPressed) {
      led28.on();
    } else {
      led28.off();
    }
    pinValue28State28 = isPressed;
  }
}
boolean pinValue29State29 = false;
void buttonLedWidget29()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue29) == LOW);

  // If state has changed...
  if (isPressed != pinValue29State29) {
    if (isPressed) {
      led29.on();
    } else {
      led29.off();
    }
    pinValue29State29 = isPressed;
  }
}
boolean pinValue30State30 = false;
void buttonLedWidget30()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue30) == LOW);

  // If state has changed...
  if (isPressed != pinValue30State30) {
    if (isPressed) {
      led30.on();
    } else {
      led30.off();
    }
    pinValue30State30 = isPressed;
  }
}
boolean pinValue31State31 = false;
void buttonLedWidget31()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue31) == LOW);

  // If state has changed...
  if (isPressed != pinValue31State31) {
    if (isPressed) {
      led31.on();
    } else {
      led31.off();
    }
    pinValue31State31 = isPressed;
  }
}
boolean pinValue32State32 = false;
void buttonLedWidget32()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue32) == LOW);

  // If state has changed...
  if (isPressed != pinValue32State32) {
    if (isPressed) {
      led32.on();
    } else {
      led32.off();
    }
    pinValue32State32 = isPressed;
  }
}
//int pinValue1;
BLYNK_WRITE(V1){
  int pinValue1 = param.asInt();
  addr1.digitalWrite(0, pinValue1);
}
//int pinValue2;
BLYNK_WRITE(V2){
  int pinValue2 = param.asInt();
  addr1.digitalWrite(1, pinValue2);
}
//int pinValue3;
BLYNK_WRITE(V3){
  int pinValue3 = param.asInt();
  addr1.digitalWrite(2, pinValue3);
}
//int pinValue4;
BLYNK_WRITE(V4){
  int pinValue4 = param.asInt();
  addr1.digitalWrite(3, pinValue4);
}
//int pinValue5;
BLYNK_WRITE(V5){
  int pinValue5 = param.asInt();
  addr1.digitalWrite(4, pinValue5);
}
//int pinValue6;
BLYNK_WRITE(V6){
  int pinValue6 = param.asInt();
  addr1.digitalWrite(5, pinValue6);
}
//int pinValue7;
BLYNK_WRITE(V7){
  int pinValue7 = param.asInt();
  addr1.digitalWrite(6, pinValue7);
}
//int pinValue8;
BLYNK_WRITE(V8){
  int pinValue8 = param.asInt();
  addr1.digitalWrite(7, pinValue8);
}
//int pinValue9;
BLYNK_WRITE(V9){
  int pinValue9 = param.asInt();
  addr2.digitalWrite(0, pinValue9);
}
//int pinValue10;
BLYNK_WRITE(V10){
  int pinValue10 = param.asInt();
  addr2.digitalWrite(1, pinValue10);
}
//int pinValue11;
BLYNK_WRITE(V11){
  int pinValue11 = param.asInt();
  addr2.digitalWrite(2, pinValue11);
}
//int pinValue12;
BLYNK_WRITE(V12){
  int pinValue12 = param.asInt();
  addr2.digitalWrite(3, pinValue12);
}
//int pinValue13;
BLYNK_WRITE(V13){
  int pinValue13 = param.asInt();
  addr2.digitalWrite(4, pinValue13);
}
//int pinValue14;
BLYNK_WRITE(V14){
  int pinValue14 = param.asInt();
  addr2.digitalWrite(5, pinValue14);
}
//int pinValue15;
BLYNK_WRITE(V15){
  int pinValue15 = param.asInt();
  addr2.digitalWrite(6, pinValue15);
}
//int pinValue16;
BLYNK_WRITE(V16){
  int pinValue16 = param.asInt();
  addr2.digitalWrite(7, pinValue16);
}
//int pinValue17;
BLYNK_WRITE(V17){
  int pinValue17 = param.asInt();
  addr3.digitalWrite(0, pinValue17);
}
//int pinValue18;
BLYNK_WRITE(V18){
  int pinValue18 = param.asInt();
  addr3.digitalWrite(1, pinValue18);
}
//int pinValue19;
BLYNK_WRITE(V19){
  int pinValue19 = param.asInt();
  addr3.digitalWrite(2, pinValue19);
}
//int pinValue20;
BLYNK_WRITE(V20){
  int pinValue20 = param.asInt();
  addr3.digitalWrite(3, pinValue20);
}
//int pinValue21;
BLYNK_WRITE(V21){
  int pinValue21 = param.asInt();
  addr3.digitalWrite(4, pinValue21);
}
//int pinValue22;
BLYNK_WRITE(V22){
  int pinValue22 = param.asInt();
  addr3.digitalWrite(5, pinValue22);
}
//int pinValue23;
BLYNK_WRITE(V23){
  int pinValue23 = param.asInt();
  addr3.digitalWrite(6, pinValue23);
}
//int pinValue24;
BLYNK_WRITE(V24){
  int pinValue24 = param.asInt();
  addr3.digitalWrite(7, pinValue24);
}
//int pinValue25;
BLYNK_WRITE(V25){
  int pinValue25 = param.asInt();
  addr4.digitalWrite(0, pinValue25);
}
//int pinValue26;
BLYNK_WRITE(V26){
  int pinValue26 = param.asInt();
  addr4.digitalWrite(1, pinValue26);
}
//int pinValue27;
BLYNK_WRITE(V27){
  int pinValue27 = param.asInt();
  addr4.digitalWrite(2, pinValue27);
}
//int pinValue28;
BLYNK_WRITE(V28){
  int pinValue28 = param.asInt();
  addr4.digitalWrite(3, pinValue28);
}
//int pinValue29;
BLYNK_WRITE(V29){
  int pinValue29 = param.asInt();
  addr4.digitalWrite(4, pinValue29);
}
//int pinValue30;
BLYNK_WRITE(V30){
  int pinValue30 = param.asInt();
  addr4.digitalWrite(5, pinValue30);
}
//int pinValue31;
BLYNK_WRITE(V31){
  int pinValue31 = param.asInt();
  addr4.digitalWrite(6, pinValue31);
}
//int pinValue32;
BLYNK_WRITE(V32){
  int pinValue32 = param.asInt();
  addr4.digitalWrite(7, pinValue32);
}
  // Debug console
void setup() 
{  
   Serial.begin(115200);
   Blynk.begin(auth, ssid, pass, IPAddress(192, 168, 0, 19), 8080);


   {
    Serial.println("Es konnte kein gültiger BME280-Sensor gefunden werden, Verdrahtung prüfen!");
  }
  
  WiFi.begin(ssid, pass);

  Serial.println();
  Serial.println();
  Serial.print("Verbunden mit ");
  Serial.println(ssid);

  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi verbunden");
  
   addr1.begin();
   addr2.begin();
   addr3.begin();
   addr4.begin();
   addr1.pinMode (0, OUTPUT);
   addr1.pinMode (1, OUTPUT);
   addr1.pinMode (2, OUTPUT);
   addr1.pinMode (3, OUTPUT);
   addr1.pinMode (4, OUTPUT);
   addr1.pinMode (5, OUTPUT);
   addr1.pinMode (6, OUTPUT);
   addr1.pinMode (7, OUTPUT);
   addr2.pinMode (0, OUTPUT);
   addr2.pinMode (1, OUTPUT);
   addr2.pinMode (2, OUTPUT);
   addr2.pinMode (3, OUTPUT);
   addr2.pinMode (4, OUTPUT);
   addr2.pinMode (5, OUTPUT);
   addr2.pinMode (6, OUTPUT);
   addr2.pinMode (7, OUTPUT);
   addr3.pinMode (0, OUTPUT);
   addr3.pinMode (1, OUTPUT);
   addr3.pinMode (2, OUTPUT);
   addr3.pinMode (3, OUTPUT);
   addr3.pinMode (4, OUTPUT);
   addr3.pinMode (5, OUTPUT);
   addr3.pinMode (6, OUTPUT);
   addr3.pinMode (7, OUTPUT);
   addr4.pinMode (0, OUTPUT);
   addr4.pinMode (1, OUTPUT);
   addr4.pinMode (2, OUTPUT);
   addr4.pinMode (3, OUTPUT);
   addr4.pinMode (4, OUTPUT);
   addr4.pinMode (5, OUTPUT);
   addr4.pinMode (6, OUTPUT);
   addr4.pinMode (7, OUTPUT);
   addr1.digitalWrite (0, HIGH);
   addr1.digitalWrite (1, HIGH);
   addr1.digitalWrite (2, HIGH);
   addr1.digitalWrite (3, HIGH);
   addr1.digitalWrite (4, HIGH);
   addr1.digitalWrite (5, HIGH);
   addr1.digitalWrite (6, HIGH);
   addr1.digitalWrite (7, HIGH);
   addr2.digitalWrite (0, HIGH);
   addr2.digitalWrite (1, HIGH);
   addr2.digitalWrite (2, HIGH);
   addr2.digitalWrite (3, HIGH);
   addr2.digitalWrite (4, HIGH);
   addr2.digitalWrite (5, HIGH);
   addr2.digitalWrite (6, HIGH);
   addr2.digitalWrite (7, HIGH);
   addr3.digitalWrite (0, HIGH);
   addr3.digitalWrite (1, HIGH);
   addr3.digitalWrite (2, HIGH);
   addr3.digitalWrite (3, HIGH);
   addr3.digitalWrite (4, HIGH);
   addr3.digitalWrite (5, HIGH);
   addr3.digitalWrite (6, HIGH);
   addr3.digitalWrite (7, HIGH);
   addr4.digitalWrite (0, HIGH);
   addr4.digitalWrite (1, HIGH);
   addr4.digitalWrite (2, HIGH);
   addr4.digitalWrite (3, HIGH);
   addr4.digitalWrite (4, HIGH);
   addr4.digitalWrite (5, HIGH);
   addr4.digitalWrite (6, HIGH);
   addr4.digitalWrite (7, HIGH);

   timer.setInterval(500L, buttonLedWidget1);
   timer.setInterval(500L, buttonLedWidget2);
   timer.setInterval(500L, buttonLedWidget3);
   timer.setInterval(500L, buttonLedWidget4);
   timer.setInterval(500L, buttonLedWidget5);
   timer.setInterval(500L, buttonLedWidget6);
   timer.setInterval(500L, buttonLedWidget7);
   timer.setInterval(500L, buttonLedWidget8);
   timer.setInterval(500L, buttonLedWidget9);
   timer.setInterval(500L, buttonLedWidget10);
   timer.setInterval(500L, buttonLedWidget11);
   timer.setInterval(500L, buttonLedWidget12);
   timer.setInterval(500L, buttonLedWidget13);
   timer.setInterval(500L, buttonLedWidget14);
   timer.setInterval(500L, buttonLedWidget15);
   timer.setInterval(500L, buttonLedWidget16);
   timer.setInterval(500L, buttonLedWidget17);
   timer.setInterval(500L, buttonLedWidget18);
   timer.setInterval(500L, buttonLedWidget19);
   timer.setInterval(500L, buttonLedWidget20);
   timer.setInterval(500L, buttonLedWidget21);
   timer.setInterval(500L, buttonLedWidget22);
   timer.setInterval(500L, buttonLedWidget23);
   timer.setInterval(500L, buttonLedWidget24);
   timer.setInterval(500L, buttonLedWidget25);
   timer.setInterval(500L, buttonLedWidget26);
   timer.setInterval(500L, buttonLedWidget27);
   timer.setInterval(500L, buttonLedWidget28);
   timer.setInterval(500L, buttonLedWidget29);
   timer.setInterval(500L, buttonLedWidget30);
   timer.setInterval(500L, buttonLedWidget31);
   timer.setInterval(500L, buttonLedWidget32);   
 }

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

Good day. Does not anyone have an idea why the LED status lights do not go wrong?
I just want to know if it is because of the code or how to query the virtual pins to show the status. If I Timers, so I do not know if the relay is on or off. With the LED display you would know it.

If I use the GPIO’s of the ESP32, then it works properly with the status display. Only the virtual pins are not or wrong.
Do I have to change my code to make it work? Please help. thanks

What is this meant to do?

Pete.

I dont know.

I just copied out of the example code.
Unfortunately, I do not know enough about programming.

Please can you give me a short example of how it is “right”? Thank you very much

if e.g. the timer has triggered, the status display should light up. When the timer is over, it should be off again.

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;

Where did you copy the code from?

Pete.

https://examples.blynk.cc/?board=ESP32&shield=ESP32%20WiFi&example=Widgets%2FLED%2FLED_StatusOfButton

Okay, I guess it is a way of setting the boolean to true if the digital pin is LOW, it’s just an approach that I’ve never seen before. One for the memory banks for the future!

If you’re not a great programmer then my approach would be to strip everything right back to one physical button/LED widget and add lots of Serial.print statements os you can tract the status of various variables at key points.

Pete.

#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
char auth[] = "xxxxxxxxxx";

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

const int btnPin1 = 13;
const int btnPin2 = 16;
const int btnPin3 = 14;
const int btnPin4 = 27;
const int btnPin5 = 26;
const int btnPin6 = 25;
const int btnPin7 = 33;
const int btnPin8 = 32;
const int btnPin9 = 15;
const int btnPin10 = 2;
const int btnPin11 = 4;
const int btnPin12 = 5;
const int btnPin13 = 18;
const int btnPin14 = 19;
const int btnPin15 = 21;
const int btnPin16 = 23;

WidgetLED led1(V4);
WidgetLED led2(V5);
WidgetLED led3(V6);
WidgetLED led4(V7);
WidgetLED led5(V8);
WidgetLED led6(V9);
WidgetLED led7(V10);
WidgetLED led8(V11);
WidgetLED led9(V12);
WidgetLED led10(V13);
WidgetLED led11(V14);
WidgetLED led12(V15);
WidgetLED led13(V16);
WidgetLED led14(V17);
WidgetLED led15(V18);
WidgetLED led16(V19);

BlynkTimer timer;

boolean btnState1 = false;
void buttonLedWidget1()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin1) == LOW);

  // If state has changed...
  if (isPressed != btnState1) {
    if (isPressed) {
      led1.on();
    } else {
      led1.off();
    }
    btnState1 = isPressed;
  }
}
boolean btnState2 = false;
void buttonLedWidget2()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin2) == LOW);

  // If state has changed...
  if (isPressed != btnState2) {
    if (isPressed) {
      led2.on();
    } else {
      led2.off();
    }
    btnState2 = isPressed;
  }
}
boolean btnState3 = false;
void buttonLedWidget3()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin3) == LOW);

  // If state has changed...
  if (isPressed != btnState3) {
    if (isPressed) {
      led3.on();
    } else {
      led3.off();
    }
    btnState3 = isPressed;
  }
}
boolean btnState4 = false;
void buttonLedWidget4()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin4) == LOW);

  // If state has changed...
  if (isPressed != btnState4) {
    if (isPressed) {
      led4.on();
    } else {
      led4.off();
    }
    btnState4 = isPressed;
  }
}
boolean btnState5 = false;
void buttonLedWidget5()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin5) == LOW);

  // If state has changed...
  if (isPressed != btnState5) {
    if (isPressed) {
      led5.on();
    } else {
      led5.off();
    }
    btnState5 = isPressed;
  }
}
boolean btnState6 = false;
void buttonLedWidget6()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin6) == LOW);

  // If state has changed...
  if (isPressed != btnState6) {
    if (isPressed) {
      led6.on();
    } else {
      led6.off();
    }
    btnState6 = isPressed;
  }
}
boolean btnState7 = false;
void buttonLedWidget7()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin7) == LOW);

  // If state has changed...
  if (isPressed != btnState7) {
    if (isPressed) {
      led7.on();
    } else {
      led7.off();
    }
    btnState7 = isPressed;
  }
}
boolean btnState8 = false;
void buttonLedWidget8()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin8) == LOW);

  // If state has changed...
  if (isPressed != btnState8) {
    if (isPressed) {
      led8.on();
    } else {
      led8.off();
    }
    btnState8 = isPressed;
  }
}
boolean btnState9 = false;
void buttonLedWidget9()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin9) == LOW);

  // If state has changed...
  if (isPressed != btnState9) {
    if (isPressed) {
      led9.on();
    } else {
      led9.off();
    }
    btnState9 = isPressed;
  }
}
boolean btnState10 = false;
void buttonLedWidget10()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin10) == LOW);

  // If state has changed...
  if (isPressed != btnState10) {
    if (isPressed) {
      led10.on();
    } else {
      led10.off();
    }
    btnState10 = isPressed;
  }
}
boolean btnState11 = false;
void buttonLedWidget11()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin11) == LOW);

  // If state has changed...
  if (isPressed != btnState11) {
    if (isPressed) {
      led11.on();
    } else {
      led11.off();
    }
    btnState11 = isPressed;
  }
}
boolean btnState12 = false;
void buttonLedWidget12()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin12) == LOW);

  // If state has changed...
  if (isPressed != btnState12) {
    if (isPressed) {
      led12.on();
    } else {
      led12.off();
    }
    btnState12 = isPressed;
  }
}
boolean btnState13 = false;
void buttonLedWidget13()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin13) == LOW);

  // If state has changed...
  if (isPressed != btnState13) {
    if (isPressed) {
      led13.on();
    } else {
      led13.off();
    }
    btnState13 = isPressed;
  }
}
boolean btnState14 = false;
void buttonLedWidget14()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin14) == LOW);

  // If state has changed...
  if (isPressed != btnState14) {
    if (isPressed) {
      led14.on();
    } else {
      led14.off();
    }
    btnState14 = isPressed;
  }
}
boolean btnState15 = false;
void buttonLedWidget15()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin15) == LOW);

  // If state has changed...
  if (isPressed != btnState15) {
    if (isPressed) {
      led15.on();
    } else {
      led15.off();
    }
    btnState15 = isPressed;
  }
}
boolean btnState16 = false;
void buttonLedWidget16()
{
  // Read button
  boolean isPressed = (digitalRead(btnPin16) == LOW);

  // If state has changed...
  if (isPressed != btnState16) {
    if (isPressed) {
      led16.on();
    } else {
      led16.off();
    }
    btnState16 = isPressed;
  }
}
void setup()
{
  Serial.begin(115200);

  WiFi.begin(ssid, pass);

  Serial.println();
  Serial.println();
  Serial.print("Verbunden mit ");
  Serial.println(ssid);

  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi verbunden");
  
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);
  pinMode(16, OUTPUT);
  digitalWrite(16, HIGH);
  pinMode(14, OUTPUT);
  digitalWrite(14, HIGH);
  pinMode(27, OUTPUT);
  digitalWrite(27, HIGH);
  pinMode(26, OUTPUT);
  digitalWrite(26, HIGH);
  pinMode(25, OUTPUT);
  digitalWrite(25, HIGH);
  pinMode(33, OUTPUT);
  digitalWrite(33, HIGH);
  pinMode(32, OUTPUT);
  digitalWrite(32, HIGH);
  pinMode(15, OUTPUT);
  digitalWrite(15, HIGH);
  pinMode(2, OUTPUT);
  digitalWrite(2, HIGH);
  pinMode(4, OUTPUT);
  digitalWrite(4, HIGH);
  pinMode(5, OUTPUT);
  digitalWrite(5, HIGH);
  pinMode(18, OUTPUT);
  digitalWrite(18, HIGH);
  pinMode(19, OUTPUT);
  digitalWrite(19, HIGH);
  pinMode(21, OUTPUT);
  digitalWrite(21, HIGH);
  pinMode(23, OUTPUT);
  digitalWrite(23, HIGH);



  // Debug console
  
  Blynk.begin(auth, ssid, pass, IPAddress(192, 168, 0, 19), 8080);

  pinMode(btnPin1, 13);
  pinMode(btnPin2, 16);
  pinMode(btnPin3, 14);
  pinMode(btnPin4, 27);
  pinMode(btnPin5, 26);
  pinMode(btnPin6, 25);
  pinMode(btnPin7, 33);
  pinMode(btnPin8, 32);
  pinMode(btnPin9, 15);
  pinMode(btnPin10, 2);
  pinMode(btnPin11, 4);
  pinMode(btnPin12, 5);
  pinMode(btnPin13, 18);
  pinMode(btnPin14, 19);
  pinMode(btnPin15, 21);
  pinMode(btnPin16, 23);



  // Richten Sie eine Funktion ein, die alle 100 ms aufgerufen werden soll
  timer.setInterval(500L, buttonLedWidget1);
  timer.setInterval(500L, buttonLedWidget2);
  timer.setInterval(500L, buttonLedWidget3);
  timer.setInterval(500L, buttonLedWidget4);
  timer.setInterval(500L, buttonLedWidget5);
  timer.setInterval(500L, buttonLedWidget6);
  timer.setInterval(500L, buttonLedWidget7);
  timer.setInterval(500L, buttonLedWidget8);
  timer.setInterval(500L, buttonLedWidget9);
  timer.setInterval(500L, buttonLedWidget10);
  timer.setInterval(500L, buttonLedWidget11);
  timer.setInterval(500L, buttonLedWidget12);
  timer.setInterval(500L, buttonLedWidget13);
  timer.setInterval(500L, buttonLedWidget14);
  timer.setInterval(500L, buttonLedWidget15);
  timer.setInterval(500L, buttonLedWidget16);
}

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

This code works as it should. Here, however, only 16 relays are switched and therefore the GPIOs of the ESP32 have been used.
But I want to switch 32 relays and therefore use the PCF8574. Basically yes the code works and I can switch all 32 relays. Only just the status display does not work.
Let’s test it and set the value to TRUE. Then give me notice. Unfortunately, it will be only this evening. In any case, please contact me again. Thank you very much

“Okay, I guess it is a way of setting the boolean to true if the digital pin is LOW, it’s just an approach that I’ve never seen before. One for the memory banks for the future!”

so, have tested.
boolean btnState = true;
void buttonLedWidget ()

Unfortunately that did not work. I have now found a sample sketch for reading the PCF8574. Will try this time and adapt, if it works then.

#include <Wire.h>    // Required for I2C communication
#include "PCF8574.h" // Required for PCF8574

/* PCF8574 instance */
PCF8574 expander;

boolean pinstate;   // Variable, um den Status des Pin zu speichern


void setup() {
  Serial.begin(9600);

/* Start I2C bus and PCF8574 instance */
  expander.begin(0x38);  // PCF mit ADresse starten A0=0, A1=0, A2=0
  
  /* Setup some PCF8574 pins for demo */
  expander.pinMode(0, OUTPUT);
  expander.pinMode(1, OUTPUT);
  expander.pinMode(2, OUTPUT);
  expander.pinMode(3, INPUT);
  expander.digitalWrite(0, HIGH); // LED 1 aus
  expander.digitalWrite(1, HIGH); // LED 2 aus
  expander.digitalWrite(2, HIGH); // LED 3 aus
}

void loop() {

 // digitalRead demo

pinstate = expander.digitalRead(3);
Serial.println("DigitalRead Demo mit Variable pinstate");
Serial.print("pinstate= ");
Serial.println(pinstate);

Serial.println("DigitalRead Demo direkte Anzeige");
Serial.println(expander.digitalRead(3) ? "HIGH" : "LOW"); // Print button pin state
delay(200);
}

how exactly would the example look like for a pin (for example pin 0)?

Please can you give me an example for a pin, so that the status indicator (LED on / off) then goes? I can not continue this way.

Thank you very much

I have no idea what you mean by this.

The sketch you posted is not suitable for use with Blynk without considerable modification, because of the fact that everything is done in the void loop and there are delays in use.
I’d recommend that you don’t waste your time with this sketch.

Instead, I’d add some meaningful Serial.print statements to your original code, like this:

void buttonLedWidget2()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue2) == LOW);

  // If state has changed...
  if (isPressed != pinValue2State2)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led2 on...");    
      led2.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led2 off...");          
      led2.off();
    }
    pinValue2State2 = isPressed;
  }
}


Pete.

Great. Thank you very much

Will it then try the same time.

I still have a lot of learning. Have a nice Sunday

Sadly it still does not work. I once attached my sketch and the serial issues. Likewise, I made a little video. Somehow does not seem to go with the virtual pins.

#define BLYNK_PRINT Serial
#include <PCF8574.h> 
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.h>
#include <Wire.h>
#define SDA_PIN 21 //GPIO21 an ESP32
#define SCL_PIN 22 //GPIO22 an ESP32

PCF8574 addr1 (0x20);          // PCF8574 device (addr1) 1 ACHTUNG! Adresse 0x20 einstellen A0>0,A1>0,A2>0 Port-Bereich P0-P8 (addr Namen kann man frei wählen)
PCF8574 addr2 (0x21);          // PCF8574 device (addr2) 2 ACHTUNG! Adresse 0x21 einstellen A0>1,A1>0,A2>0 Port-Bereich P0-P8
PCF8574 addr3 (0x22);          // PCF8574 device (addr3) 3 ACHTUNG! Adresse 0x22 einstellen A0>0,A1>1,A2>0 Port-Bereich P0-P8
PCF8574 addr4 (0x23);          // PCF8574 device (addr4) 4 ACHTUNG! Adresse 0x23 einstellen A0>1,A1>1,A2>0 Port-Bereich P0-P8
//PCF8574 addr5 (0x24);        // PCF8574 device (addr5) 5 ACHTUNG! Adresse 0x24 einstellen A0>0,A1>0,A2>1 Port-Bereich P0-P8
//PCF8574 addr6 (0x25);        // PCF8574 device (addr6) 6 ACHTUNG! Adresse 0x25 einstellen A0>1,A1>0,A2>1 Port-Bereich P0-P8
//PCF8574 addr7 (0x26);        // PCF8574 device (addr7) 7 ACHTUNG! Adresse 0x26 einstellen A0>0,A1>1,A2>1 Port-Bereich P0-P8
//PCF8574 addr8 (0x27);        // PCF8574 device (addr8) 8 ACHTUNG! Adresse 0x27 einstellen A0>1,A1>1,A2>1 Port-Bereich P0-P8


char auth[] = "xxxxxxxxxxxxxxxxx";

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

const int pinValue1 = 0;
const int pinValue2 = 1;
const int pinValue3 = 2;
const int pinValue4 = 3;
const int pinValue5 = 4;
const int pinValue6 = 5;
const int pinValue7 = 6;
const int pinValue8 = 7;
const int pinValue9 = 0;
const int pinValue10 = 1;
const int pinValue11 = 2;
const int pinValue12 = 3;
const int pinValue13 = 4;
const int pinValue14 = 5;
const int pinValue15 = 6;
const int pinValue16 = 7;
const int pinValue17 = 0;
const int pinValue18 = 1;
const int pinValue19 = 2;
const int pinValue20 = 3;
const int pinValue21 = 4;
const int pinValue22 = 5;
const int pinValue23 = 6;
const int pinValue24 = 7;
const int pinValue25 = 0;
const int pinValue26 = 1;
const int pinValue27 = 2;
const int pinValue28 = 3;
const int pinValue29 = 4;
const int pinValue30 = 5;
const int pinValue31 = 6;
const int pinValue32 = 7;


WidgetLED led1(V33);
WidgetLED led2(V34);
WidgetLED led3(V35);
WidgetLED led4(V36);
WidgetLED led5(V37);
WidgetLED led6(V38);
WidgetLED led7(V39);
WidgetLED led8(V40);
WidgetLED led9(V41);
WidgetLED led10(V42);
WidgetLED led11(V43);
WidgetLED led12(V44);
WidgetLED led13(V45);
WidgetLED led14(V46);
WidgetLED led15(V47);
WidgetLED led16(V48);
WidgetLED led17(V49);
WidgetLED led18(V50);
WidgetLED led19(V51);
WidgetLED led20(V52);
WidgetLED led21(V53);
WidgetLED led22(V54);
WidgetLED led23(V55);
WidgetLED led24(V56);
WidgetLED led25(V57);
WidgetLED led26(V58);
WidgetLED led27(V59);
WidgetLED led28(V60);
WidgetLED led29(V61);
WidgetLED led30(V62);
WidgetLED led31(V63);
WidgetLED led32(V64);

BlynkTimer timer;


boolean pinValue1Status1 = false;
void buttonLedWidget1()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue1) == LOW);

  // If state has changed...
  if (isPressed != pinValue1Status1)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led1 on...");    
      led1.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led1 off...");          
      led1.off();
    }
    pinValue1Status1 = isPressed;
  }
}
boolean pinValue2Status2 = false;
void buttonLedWidget2()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue2) == LOW);

  // If state has changed...
  if (isPressed != pinValue2Status2)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led2 on...");    
      led2.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led2 off...");          
      led2.off();
    }
    pinValue2Status2 = isPressed;
  }
}
boolean pinValue3Status3 = false;
void buttonLedWidget3()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue3) == LOW);

  // If state has changed...
  if (isPressed != pinValue3Status3)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led3 on...");    
      led3.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led3 off...");          
      led3.off();
    }
    pinValue3Status3 = isPressed;
  }
}
boolean pinValue4Status4 = false;
void buttonLedWidget4()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue4) == LOW);

  // If state has changed...
  if (isPressed != pinValue4Status4)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led4 on...");    
      led4.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led4 off...");          
      led4.off();
    }
    pinValue4Status4 = isPressed;
  }
}
boolean pinValue5Status5 = false;
void buttonLedWidget5()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue5) == LOW);

  // If state has changed...
  if (isPressed != pinValue5Status5)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led5 on...");    
      led5.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led5 off...");          
      led5.off();
    }
    pinValue5Status5 = isPressed;
  }
}
boolean pinValue6Status6 = false;
void buttonLedWidget6()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue6) == LOW);

  // If state has changed...
  if (isPressed != pinValue6Status6)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led6 on...");    
      led6.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led6 off...");          
      led6.off();
    }
    pinValue6Status6 = isPressed;
  }
}
boolean pinValue7Status7 = false;
void buttonLedWidget7()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue7) == LOW);

  // If state has changed...
  if (isPressed != pinValue7Status7)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led7 on...");    
      led7.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led7 off...");          
      led7.off();
    }
    pinValue7Status7 = isPressed;
  }
}
boolean pinValue8Status8 = false;
void buttonLedWidget8()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue8) == LOW);

  // If state has changed...
  if (isPressed != pinValue8Status8)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led8 on...");    
      led8.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led2 off...");          
      led8.off();
    }
    pinValue8Status8 = isPressed;
  }
}
boolean pinValue9Status9 = false;
void buttonLedWidget9()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue9) == LOW);

  // If state has changed...
  if (isPressed != pinValue9Status9)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led9 on...");    
      led9.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led9 off...");          
      led9.off();
    }
    pinValue9Status9 = isPressed;
  }
}
boolean pinValue10Status10 = false;
void buttonLedWidget10()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue10) == LOW);

  // If state has changed...
  if (isPressed != pinValue10Status10)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led10 on...");    
      led10.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led10 off...");          
      led10.off();
    }
    pinValue10Status10 = isPressed;
  }
}
boolean pinValue11Status11 = false;
void buttonLedWidget11()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue11) == LOW);

  // If state has changed...
  if (isPressed != pinValue11Status11)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led11 on...");    
      led11.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led11 off...");          
      led11.off();
    }
    pinValue11Status11 = isPressed;
  }
}
boolean pinValue12Status12 = false;
void buttonLedWidget12()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue12) == LOW);

  // If state has changed...
  if (isPressed != pinValue12Status12)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led12 on...");    
      led12.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led12 off...");          
      led12.off();
    }
    pinValue12Status12 = isPressed;
  }
}
boolean pinValue13Status13 = false;
void buttonLedWidget13()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue13) == LOW);

  // If state has changed...
  if (isPressed != pinValue13Status13)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led13 on...");    
      led13.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led13 off...");          
      led13.off();
    }
    pinValue13Status13 = isPressed;
  }
}
boolean pinValue14Status14 = false;
void buttonLedWidget14()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue14) == LOW);

  // If state has changed...
  if (isPressed != pinValue14Status14)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led14 on...");    
      led14.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led14 off...");          
      led14.off();
    }
    pinValue14Status14 = isPressed;
  }
}
boolean pinValue15Status15 = false;
void buttonLedWidget15()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue15) == LOW);

  // If state has changed...
  if (isPressed != pinValue15Status15)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led15 on...");    
      led15.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led15 off...");          
      led15.off();
    }
    pinValue15Status15 = isPressed;
  }
}
boolean pinValue16Status16 = false;
void buttonLedWidget16()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue16) == LOW);

  // If state has changed...
  if (isPressed != pinValue16Status16)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led16 on...");    
      led16.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led16 off...");          
      led16.off();
    }
    pinValue16Status16 = isPressed;
  }
}
boolean pinValue17Status17 = false;
void buttonLedWidget17()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue17) == LOW);

  // If state has changed...
  if (isPressed != pinValue17Status17)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led17 on...");    
      led17.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led17 off...");          
      led17.off();
    }
    pinValue17Status17 = isPressed;
  }
}
boolean pinValue18Status18 = false;
void buttonLedWidget18()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue18) == LOW);

  // If state has changed...
  if (isPressed != pinValue18Status18)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led18 on...");    
      led18.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led18 off...");          
      led18.off();
    }
    pinValue18Status18 = isPressed;
  }
}
boolean pinValue19Status19 = false;
void buttonLedWidget19()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue19) == LOW);

  // If state has changed...
  if (isPressed != pinValue19Status19)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led19 on...");    
      led19.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led19 off...");          
      led19.off();
    }
    pinValue19Status19 = isPressed;
  }
}
boolean pinValue20Status20 = false;
void buttonLedWidget20()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue20) == LOW);

  // If state has changed...
  if (isPressed != pinValue20Status20)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led20 on...");    
      led20.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led20 off...");          
      led20.off();
    }
    pinValue20Status20 = isPressed;
  }
}
boolean pinValue21Status21 = false;
void buttonLedWidget21()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue21) == LOW);

  // If state has changed...
  if (isPressed != pinValue21Status21)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led21 on...");    
      led21.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led21 off...");          
      led21.off();
    }
    pinValue21Status21 = isPressed;
  }
}
boolean pinValue22Status22 = false;
void buttonLedWidget22()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue22) == LOW);

  // If state has changed...
  if (isPressed != pinValue22Status22)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led22 on...");    
      led22.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led22 off...");          
      led22.off();
    }
    pinValue22Status22 = isPressed;
  }
}
boolean pinValue23Status23 = false;
void buttonLedWidget23()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue23) == LOW);

  // If state has changed...
  if (isPressed != pinValue23Status23)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led23 on...");    
      led23.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led23 off...");          
      led23.off();
    }
    pinValue23Status23 = isPressed;
  }
}
boolean pinValue24Status24 = false;
void buttonLedWidget24()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue24) == LOW);

  // If state has changed...
  if (isPressed != pinValue24Status24)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led24 on...");    
      led24.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led24 off...");          
      led24.off();
    }
    pinValue24Status24 = isPressed;
  }
}
boolean pinValue25Status25 = false;
void buttonLedWidget25()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue25) == LOW);

  // If state has changed...
  if (isPressed != pinValue25Status25)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led25 on...");    
      led25.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led25 off...");          
      led25.off();
    }
    pinValue25Status25 = isPressed;
  }
}
boolean pinValue26Status26 = false;
void buttonLedWidget26()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue26) == LOW);

  // If state has changed...
  if (isPressed != pinValue26Status26)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led26 on...");    
      led26.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led26 off...");          
      led26.off();
    }
    pinValue26Status26 = isPressed;
  }
}
boolean pinValue27Status27 = false;
void buttonLedWidget27()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue27) == LOW);

  // If state has changed...
  if (isPressed != pinValue27Status27)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led27 on...");    
      led27.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led27 off...");          
      led27.off();
    }
    pinValue27Status27 = isPressed;
  }
}
boolean pinValue28Status28 = false;
void buttonLedWidget28()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue28) == LOW);

  // If state has changed...
  if (isPressed != pinValue28Status28)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led28 on...");    
      led28.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led28 off...");          
      led28.off();
    }
    pinValue28Status28 = isPressed;
  }
}
boolean pinValue29Status29 = false;
void buttonLedWidget29()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue29) == LOW);

  // If state has changed...
  if (isPressed != pinValue29Status29)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led29 on...");    
      led29.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led29 off...");          
      led29.off();
    }
    pinValue29Status29 = isPressed;
  }
}
boolean pinValue30Status30 = false;
void buttonLedWidget30()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue30) == LOW);

  // If state has changed...
  if (isPressed != pinValue30Status30)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led30 on...");    
      led30.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led30 off...");          
      led30.off();
    }
    pinValue30Status30 = isPressed;
  }
}
boolean pinValue31Status31 = false;
void buttonLedWidget31()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue31) == LOW);

  // If state has changed...
  if (isPressed != pinValue31Status31)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led31 on...");    
      led31.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led31 off...");          
      led31.off();
    }
    pinValue31Status31 = isPressed;
  }
}
boolean pinValue32Status32 = false;
void buttonLedWidget32()
{
  // Read button
  boolean isPressed = (digitalRead(pinValue32) == LOW);

  // If state has changed...
  if (isPressed != pinValue32Status32)
  Serial.println("State has changed");
 {
    if (isPressed) 
    {
      Serial.println("isPressed = true, turning led32 on...");    
      led32.on();
    } 
    else 
    {
      Serial.println("isPressed = false, turning led32 off...");          
      led32.off();
    }
    pinValue32Status32 = isPressed;
  }
}
//int pinValue1;
BLYNK_WRITE(V1){
  int pinValue1 = param.asInt();
  addr1.digitalWrite(0, pinValue1);
}
//int pinValue2;
BLYNK_WRITE(V2){
  int pinValue2 = param.asInt();
  addr1.digitalWrite(1, pinValue2);
}
//int pinValue3;
BLYNK_WRITE(V3){
  int pinValue3 = param.asInt();
  addr1.digitalWrite(2, pinValue3);
}
//int pinValue4;
BLYNK_WRITE(V4){
  int pinValue4 = param.asInt();
  addr1.digitalWrite(3, pinValue4);
}
//int pinValue5;
BLYNK_WRITE(V5){
  int pinValue5 = param.asInt();
  addr1.digitalWrite(4, pinValue5);
}
//int pinValue6;
BLYNK_WRITE(V6){
  int pinValue6 = param.asInt();
  addr1.digitalWrite(5, pinValue6);
}
//int pinValue7;
BLYNK_WRITE(V7){
  int pinValue7 = param.asInt();
  addr1.digitalWrite(6, pinValue7);
}
//int pinValue8;
BLYNK_WRITE(V8){
  int pinValue8 = param.asInt();
  addr1.digitalWrite(7, pinValue8);
}
//int pinValue9;
BLYNK_WRITE(V9){
  int pinValue9 = param.asInt();
  addr2.digitalWrite(0, pinValue9);
}
//int pinValue10;
BLYNK_WRITE(V10){
  int pinValue10 = param.asInt();
  addr2.digitalWrite(1, pinValue10);
}
//int pinValue11;
BLYNK_WRITE(V11){
  int pinValue11 = param.asInt();
  addr2.digitalWrite(2, pinValue11);
}
//int pinValue12;
BLYNK_WRITE(V12){
  int pinValue12 = param.asInt();
  addr2.digitalWrite(3, pinValue12);
}
//int pinValue13;
BLYNK_WRITE(V13){
  int pinValue13 = param.asInt();
  addr2.digitalWrite(4, pinValue13);
}
//int pinValue14;
BLYNK_WRITE(V14){
  int pinValue14 = param.asInt();
  addr2.digitalWrite(5, pinValue14);
}
//int pinValue15;
BLYNK_WRITE(V15){
  int pinValue15 = param.asInt();
  addr2.digitalWrite(6, pinValue15);
}
//int pinValue16;
BLYNK_WRITE(V16){
  int pinValue16 = param.asInt();
  addr2.digitalWrite(7, pinValue16);
}
//int pinValue17;
BLYNK_WRITE(V17){
  int pinValue17 = param.asInt();
  addr3.digitalWrite(0, pinValue17);
}
//int pinValue18;
BLYNK_WRITE(V18){
  int pinValue18 = param.asInt();
  addr3.digitalWrite(1, pinValue18);
}
//int pinValue19;
BLYNK_WRITE(V19){
  int pinValue19 = param.asInt();
  addr3.digitalWrite(2, pinValue19);
}
//int pinValue20;
BLYNK_WRITE(V20){
  int pinValue20 = param.asInt();
  addr3.digitalWrite(3, pinValue20);
}
//int pinValue21;
BLYNK_WRITE(V21){
  int pinValue21 = param.asInt();
  addr3.digitalWrite(4, pinValue21);
}
//int pinValue22;
BLYNK_WRITE(V22){
  int pinValue22 = param.asInt();
  addr3.digitalWrite(5, pinValue22);
}
//int pinValue23;
BLYNK_WRITE(V23){
  int pinValue23 = param.asInt();
  addr3.digitalWrite(6, pinValue23);
}
//int pinValue24;
BLYNK_WRITE(V24){
  int pinValue24 = param.asInt();
  addr3.digitalWrite(7, pinValue24);
}
//int pinValue25;
BLYNK_WRITE(V25){
  int pinValue25 = param.asInt();
  addr4.digitalWrite(0, pinValue25);
}
//int pinValue26;
BLYNK_WRITE(V26){
  int pinValue26 = param.asInt();
  addr4.digitalWrite(1, pinValue26);
}
//int pinValue27;
BLYNK_WRITE(V27){
  int pinValue27 = param.asInt();
  addr4.digitalWrite(2, pinValue27);
}
//int pinValue28;
BLYNK_WRITE(V28){
  int pinValue28 = param.asInt();
  addr4.digitalWrite(3, pinValue28);
}
//int pinValue29;
BLYNK_WRITE(V29){
  int pinValue29 = param.asInt();
  addr4.digitalWrite(4, pinValue29);
}
//int pinValue30;
BLYNK_WRITE(V30){
  int pinValue30 = param.asInt();
  addr4.digitalWrite(5, pinValue30);
}
//int pinValue31;
BLYNK_WRITE(V31){
  int pinValue31 = param.asInt();
  addr4.digitalWrite(6, pinValue31);
}
//int pinValue32;
BLYNK_WRITE(V32){
  int pinValue32 = param.asInt();
  addr4.digitalWrite(7, pinValue32);
}
  // Debug console
void setup() 
{  
   Serial.begin(115200);
   Blynk.begin(auth, ssid, pass, IPAddress(192, 168, 0, 19), 8080);


   {
    Serial.println("Es konnte kein gültiger BME280-Sensor gefunden werden, Verdrahtung prüfen!");
  }
  
  WiFi.begin(ssid, pass);

  Serial.println();
  Serial.println();
  Serial.print("Verbunden mit ");
  Serial.println(ssid);

  WiFi.begin(ssid, pass);

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("WiFi verbunden");
  
   addr1.begin();
   addr2.begin();
   addr3.begin();
   addr4.begin();
   addr1.pinMode (0, OUTPUT);
   addr1.pinMode (1, OUTPUT);
   addr1.pinMode (2, OUTPUT);
   addr1.pinMode (3, OUTPUT);
   addr1.pinMode (4, OUTPUT);
   addr1.pinMode (5, OUTPUT);
   addr1.pinMode (6, OUTPUT);
   addr1.pinMode (7, OUTPUT);
   addr2.pinMode (0, OUTPUT);
   addr2.pinMode (1, OUTPUT);
   addr2.pinMode (2, OUTPUT);
   addr2.pinMode (3, OUTPUT);
   addr2.pinMode (4, OUTPUT);
   addr2.pinMode (5, OUTPUT);
   addr2.pinMode (6, OUTPUT);
   addr2.pinMode (7, OUTPUT);
   addr3.pinMode (0, OUTPUT);
   addr3.pinMode (1, OUTPUT);
   addr3.pinMode (2, OUTPUT);
   addr3.pinMode (3, OUTPUT);
   addr3.pinMode (4, OUTPUT);
   addr3.pinMode (5, OUTPUT);
   addr3.pinMode (6, OUTPUT);
   addr3.pinMode (7, OUTPUT);
   addr4.pinMode (0, OUTPUT);
   addr4.pinMode (1, OUTPUT);
   addr4.pinMode (2, OUTPUT);
   addr4.pinMode (3, OUTPUT);
   addr4.pinMode (4, OUTPUT);
   addr4.pinMode (5, OUTPUT);
   addr4.pinMode (6, OUTPUT);
   addr4.pinMode (7, OUTPUT);
   addr1.digitalWrite (0, HIGH);
   addr1.digitalWrite (1, HIGH);
   addr1.digitalWrite (2, HIGH);
   addr1.digitalWrite (3, HIGH);
   addr1.digitalWrite (4, HIGH);
   addr1.digitalWrite (5, HIGH);
   addr1.digitalWrite (6, HIGH);
   addr1.digitalWrite (7, HIGH);
   addr2.digitalWrite (0, HIGH);
   addr2.digitalWrite (1, HIGH);
   addr2.digitalWrite (2, HIGH);
   addr2.digitalWrite (3, HIGH);
   addr2.digitalWrite (4, HIGH);
   addr2.digitalWrite (5, HIGH);
   addr2.digitalWrite (6, HIGH);
   addr2.digitalWrite (7, HIGH);
   addr3.digitalWrite (0, HIGH);
   addr3.digitalWrite (1, HIGH);
   addr3.digitalWrite (2, HIGH);
   addr3.digitalWrite (3, HIGH);
   addr3.digitalWrite (4, HIGH);
   addr3.digitalWrite (5, HIGH);
   addr3.digitalWrite (6, HIGH);
   addr3.digitalWrite (7, HIGH);
   addr4.digitalWrite (0, HIGH);
   addr4.digitalWrite (1, HIGH);
   addr4.digitalWrite (2, HIGH);
   addr4.digitalWrite (3, HIGH);
   addr4.digitalWrite (4, HIGH);
   addr4.digitalWrite (5, HIGH);
   addr4.digitalWrite (6, HIGH);
   addr4.digitalWrite (7, HIGH);

   timer.setInterval(500L, buttonLedWidget1);
   timer.setInterval(500L, buttonLedWidget2);
   timer.setInterval(500L, buttonLedWidget3);
   timer.setInterval(500L, buttonLedWidget4);
   timer.setInterval(500L, buttonLedWidget5);
   timer.setInterval(500L, buttonLedWidget6);
   timer.setInterval(500L, buttonLedWidget7);
   timer.setInterval(500L, buttonLedWidget8);
   timer.setInterval(500L, buttonLedWidget9);
   timer.setInterval(500L, buttonLedWidget10);
   timer.setInterval(500L, buttonLedWidget11);
   timer.setInterval(500L, buttonLedWidget12);
   timer.setInterval(500L, buttonLedWidget13);
   timer.setInterval(500L, buttonLedWidget14);
   timer.setInterval(500L, buttonLedWidget15);
   timer.setInterval(500L, buttonLedWidget16);
   timer.setInterval(500L, buttonLedWidget17);
   timer.setInterval(500L, buttonLedWidget18);
   timer.setInterval(500L, buttonLedWidget19);
   timer.setInterval(500L, buttonLedWidget20);
   timer.setInterval(500L, buttonLedWidget21);
   timer.setInterval(500L, buttonLedWidget22);
   timer.setInterval(500L, buttonLedWidget23);
   timer.setInterval(500L, buttonLedWidget24);
   timer.setInterval(500L, buttonLedWidget25);
   timer.setInterval(500L, buttonLedWidget26);
   timer.setInterval(500L, buttonLedWidget27);
   timer.setInterval(500L, buttonLedWidget28);
   timer.setInterval(500L, buttonLedWidget29);
   timer.setInterval(500L, buttonLedWidget30);
   timer.setInterval(500L, buttonLedWidget31);
   timer.setInterval(500L, buttonLedWidget32);   
 }

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

and here the serial output

15:46:03.838 -> State has changed
15:46:03.872 -> isPressed = true, turning led16 on...
15:46:03.907 -> isPressed = false, turning led1 off...
15:46:03.974 -> isPressed = false, turning led2 off...
15:46:04.049 -> isPressed = true, turning led3 on...
15:46:04.112 -> isPressed = false, turning led4 off...
15:46:04.179 -> isPressed = true, turning led5 on...
15:46:04.246 -> isPressed = false, turning led6 off...
15:46:04.313 -> isPressed = false, turning led7 off...
15:46:04.380 -> State has changed
15:46:04.413 -> isPressed = true, turning led8 on...
15:46:04.448 -> isPressed = false, turning led9 off...
15:46:04.516 -> isPressed = false, turning led10 off...
15:46:04.584 -> isPressed = true, turning led11 on...
15:46:04.653 -> isPressed = false, turning led12 off...
15:46:04.719 -> isPressed = true, turning led13 on...
15:46:04.787 -> isPressed = false, turning led14 off...
15:46:04.855 -> isPressed = false, turning led15 off...
15:46:04.921 -> isPressed = true, turning led16 on...
15:46:04.987 -> isPressed = false, turning led1 off...
15:46:05.055 -> isPressed = false, turning led2 off...
15:46:05.122 -> isPressed = true, turning led3 on...
15:46:05.189 -> isPressed = false, turning led4 off...
15:46:05.256 -> isPressed = true, turning led5 on...
15:46:05.322 -> isPressed = false, turning led6 off...
15:46:05.390 -> isPressed = false, turning led7 off...
15:46:05.458 -> State has changed
15:46:05.492 -> isPressed = false, turning led2 off...
15:46:05.526 -> isPressed = false, turning led9 off...
15:46:05.594 -> isPressed = false, turning led10 off...
15:46:05.661 -> isPressed = true, turning led11 on...
15:46:05.730 -> isPressed = false, turning led12 off...
15:46:05.797 -> isPressed = true, turning led13 on...
15:46:05.899 -> isPressed = false, turning led14 off...
15:46:05.935 -> isPressed = false, turning led15 off...
15:46:06.001 -> State has changed
15:46:06.034 -> isPressed = false, turning led16 off...
15:46:06.102 -> isPressed = false, turning led1 off...
15:46:06.170 -> isPressed = false, turning led2 off...
15:46:06.236 -> isPressed = true, turning led3 on...
15:46:06.303 -> isPressed = false, turning led4 off...
15:46:06.369 -> isPressed = true, turning led5 on...
15:46:06.435 -> isPressed = false, turning led6 off...
15:46:06.501 -> isPressed = false, turning led7 off...
15:46:06.568 -> isPressed = false, turning led2 off...
15:46:06.636 -> isPressed = false, turning led9 off...
15:46:06.706 -> isPressed = false, turning led10 off...
15:46:06.773 -> isPressed = true, turning led11 on...
15:46:06.842 -> isPressed = false, turning led12 off...
15:46:06.909 -> isPressed = true, turning led13 on...
15:46:06.977 -> isPressed = false, turning led14 off...
15:46:07.045 -> isPressed = false, turning led15 off...
15:46:07.113 -> isPressed = false, turning led16 off...
15:46:07.179 -> isPressed = false, turning led1 off...
15:46:07.246 -> isPressed = false, turning led2 off...
15:46:07.313 -> isPressed = true, turning led3 on...
15:46:07.380 -> isPressed = false, turning led4 off...
15:46:07.449 -> isPressed = true, turning led5 on...
15:46:07.517 -> isPressed = false, turning led6 off...
15:46:07.585 -> isPressed = false, turning led7 off...
15:46:07.651 -> isPressed = false, turning led2 off...
15:46:07.718 -> isPressed = false, turning led9 off...
15:46:07.785 -> isPressed = false, turning led10 off...
15:46:07.855 -> isPressed = true, turning led11 on...
15:46:07.922 -> isPressed = false, turning led12 off...
15:46:07.989 -> isPressed = true, turning led13 on...
15:46:08.057 -> isPressed = false, turning led14 off...
15:46:08.123 -> isPressed = false, turning led15 off...
15:46:08.190 -> State has changed

here’s the little video

There’s far too much happening here to allow us to make any sense of the results.
I wasn’t suggesting that you add these serial print messages to every function, as I said before, you need to simp,if things and cut down your code.
Focus on just one button/LED and understand what is happening with that, and what needs to be done to get it working for you, then roll that out to the other buttons/LEDs.
Any serial output that you posts needs to be annotated with information about what you did in terms of button presses, and any video needs a commentary of some sort that allows viewers to understand what they are seeing.

Pete.

Sorry, I also tried with only 2 pins, the same result.

I give up now and take 2 pieces of ESP32 for the 32 relays. This is how it should be.

in the video you can clearly see that the status LED wildly mess up and off again.