Four push button

Good morning all,
I have a problem in my code. I want to control 4 relays with four push button and / or blynk application.
I only have button 1 which reacts quickly with aplication.
Do you have any idea how to fix this problem


#define BLYNK_PRINT Serial


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

#include <SPI.h>
#include <Wire.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

BlynkTimer timer;

char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

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

// Set your LED and physical button pins here
const int relais1 = 17;
const int btn1 = 25;
const int led1 = 33;

const int relais2 = 5;
const int btn2 = 26;
const int led2 = 32;


const int relais3 = 18;
const int btn3 = 27;
const int led3 = 35;

const int relais4 = 19;
const int btn4 = 14;
const int led4 = 34;

// one wire temperature
#define ONE_WIRE_BUS 23
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int deviceCount = 3;
float tempC;






void checkPhysicalButton1();
void checkPhysicalButton2();
void checkPhysicalButton3();
void checkPhysicalButton4();
void temperature();


int relais1Sate = LOW;
int btn1State = HIGH;
int led1State = LOW;

int relais2Sate = LOW;
int btn2State = HIGH;
int led2State = LOW;

int relais3Sate = LOW;
int btn3State = HIGH;
int led3State = LOW;

int relais4Sate = LOW;
int btn4State = HIGH;
int led4State = LOW;

int lcd_position[] = {16, 30, 44}; // position temperature sur l'Ă©cran


BLYNK_WRITE(V1) {
  relais1Sate = param.asInt();
  digitalWrite(relais1, relais1Sate);
  led1State = param.asInt();
  digitalWrite(led1, led1State);

}

BLYNK_WRITE(V2) {
  relais2Sate = param.asInt();
  digitalWrite(relais2, relais2Sate);
  led2State = param.asInt();
  digitalWrite(led2, led2State);

}

BLYNK_WRITE(V3) {
  relais3Sate = param.asInt();
  digitalWrite(relais3, relais3Sate);
  led3State = param.asInt();
  digitalWrite(led3, led3State);

}

BLYNK_WRITE(V4) {
  relais4Sate = param.asInt();
  digitalWrite(relais4, relais4Sate);
  led4State = param.asInt();
  digitalWrite(led4, led4State);

}

void temperature()
{
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);


  display.setCursor(0, 0);
  display.println("---------------------");
  display.setCursor(0, 6);
  display.print("|    Temperature    |");
  display.setCursor(0, 12);
  display.println("---------------------");

  display.setCursor(0, 16); // position 0
  display.println(" Interieur  |");
  display.print("---------------------");
  display.display();

  display.setCursor(0, 30); // position 1
  display.println(" Exterrieur |");
  display.print("---------------------");
  display.display();

  display.setCursor(0, 44); // position 2
  display.println(" Eau        |");
  display.print("---------------------");
  display.display();




  // Send command to all the sensors for temperature conversion
  sensors.requestTemperatures();

  // Display temperature from each sensor
  for (int i = 0;  i < deviceCount;  i++)
  {

    tempC = sensors.getTempCByIndex(i);
    Blynk.virtualWrite(i + 21, tempC);
    display.setCursor(80, lcd_position[i]);
    display.print(tempC);
    display.display();

  }
}


void checkPhysicalButton1()
{
  if (digitalRead(btn1) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn1State != LOW) {

      // Toggle LED state
      relais1Sate = !relais1Sate;
      digitalWrite(relais1, relais1Sate);
      led1State = !led1State;
      digitalWrite(led1, led1State);

      // Update Button Widget
      Blynk.virtualWrite(V1, relais1Sate);
      Blynk.virtualWrite(V1, led1State);

    }
    btn1State = LOW;
  } else {
    btn1State = HIGH;
  }
}

void checkPhysicalButton2()
{
  if (digitalRead(btn2) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn2State != LOW) {

      // Toggle LED state
      relais2Sate = !relais2Sate;
      digitalWrite(relais2, relais2Sate);
      led2State = !led2State;
      digitalWrite(led2, led2State);

      // Update Button Widget
      Blynk.virtualWrite(V2, relais1Sate);
      Blynk.virtualWrite(V2, led1State);

    }
    btn2State = LOW;
  } else {
    btn2State = HIGH;
  }
}

void checkPhysicalButton3()
{
  if (digitalRead(btn3) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn3State != LOW) {

      // Toggle LED state
      relais3Sate = !relais3Sate;
      digitalWrite(relais3, relais3Sate);
      led3State = !led3State;
      digitalWrite(led3, led3State);

      // Update Button Widget
      Blynk.virtualWrite(V3, relais1Sate);
      Blynk.virtualWrite(V3, led1State);

    }
    btn3State = LOW;
  } else {
    btn3State = HIGH;
  }
}

void checkPhysicalButton4()
{
  if (digitalRead(btn4) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn4State != LOW) {

      // Toggle LED state
      relais4Sate = !relais4Sate;
      digitalWrite(relais4, relais4Sate);
      led4State = !led4State;
      digitalWrite(led4, led4State);

      // Update Button Widget
      Blynk.virtualWrite(V4, relais1Sate);
      Blynk.virtualWrite(V4, led1State);

    }
    btn4State = LOW;
  } else {
    btn4State = HIGH;
  }
}





void setup()
{
  sensors.begin();  // debut de la librairie capteur de température
  // Debug console
  Serial.begin(9600);
  WiFi.begin(ssid, pass);
  //timer.setInterval(3000L, checkBlynk); // check if connected to Blynk server every 3 seconds
  Blynk.config(auth);

  pinMode(relais1, OUTPUT);
  pinMode(btn1, INPUT_PULLUP);
  digitalWrite(relais1, relais1Sate);
  pinMode(led1, OUTPUT);

  pinMode(relais2, OUTPUT);
  pinMode(btn2, INPUT_PULLUP);
  digitalWrite(relais2, relais2Sate);
  pinMode(led2, OUTPUT);

  pinMode(relais3, OUTPUT);
  pinMode(btn3, INPUT_PULLUP);
  digitalWrite(relais3, relais3Sate);
  pinMode(led3, OUTPUT);

  pinMode(relais4, OUTPUT);
  pinMode(btn4, INPUT_PULLUP);
  digitalWrite(relais4, relais4Sate);
  pinMode(led4, OUTPUT);


  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }

  // Clear the buffer
  display.clearDisplay();
  display.display();


  timer.setInterval(100L, checkPhysicalButton1);
  timer.setInterval(200L, checkPhysicalButton2);
  timer.setInterval(300L, checkPhysicalButton3);
  timer.setInterval(400L, checkPhysicalButton4);
  timer.setInterval(10000L, temperature);

}



void loop()
{
  Blynk.run();
  timer.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

Button 1 is being checked every 100 milliseconds,
Button 2 is being checked every 200 milliseconds,
Button 3 is being checked every 300 milliseconds,
Button 4 is being checked every 400 milliseconds

It’s not surprising that button 4 is four times less responsible than button 1.

The sensible solution is to have one timer which calls a function that checks each of the 4 buttons in turn.
Or, attach interrupts to the four buttons so that you don’t have to keep scanning them.

Pete.

is it better ??

#define BLYNK_PRINT Serial


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

#include <SPI.h>
#include <Wire.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

BlynkTimer timer;

char auth[] = "xxxxxxxxxxxx";

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

// Set your LED and physical button pins here
const int relais1 = 17;
const int btn1 = 25;
const int led1 = 33;

const int relais2 = 5;
const int btn2 = 26;
const int led2 = 32;


const int relais3 = 18;
const int btn3 = 27;
const int led3 = 35;

const int relais4 = 19;
const int btn4 = 14;
const int led4 = 34;

// one wire temperature
#define ONE_WIRE_BUS 23
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int deviceCount = 3;
float tempC;






void checkPhysicalButton1();
void checkPhysicalButton2();
void checkPhysicalButton3();
void checkPhysicalButton4();
void temperature();


int relais1Sate = LOW;
int btn1State = HIGH;
int led1State = LOW;

int relais2Sate = LOW;
int btn2State = HIGH;
int led2State = LOW;

int relais3Sate = LOW;
int btn3State = HIGH;
int led3State = LOW;

int relais4Sate = LOW;
int btn4State = HIGH;
int led4State = LOW;

int lcd_position[] = {16, 30, 44}; // position temperature sur l'Ă©cran


BLYNK_WRITE(V1) {
  relais1Sate = param.asInt();
  digitalWrite(relais1, relais1Sate);
  led1State = param.asInt();
  digitalWrite(led1, led1State);

}

BLYNK_WRITE(V2) {
  relais2Sate = param.asInt();
  digitalWrite(relais2, relais2Sate);
  led2State = param.asInt();
  digitalWrite(led2, led2State);

}

BLYNK_WRITE(V3) {
  relais3Sate = param.asInt();
  digitalWrite(relais3, relais3Sate);
  led3State = param.asInt();
  digitalWrite(led3, led3State);

}

BLYNK_WRITE(V4) {
  relais4Sate = param.asInt();
  digitalWrite(relais4, relais4Sate);
  led4State = param.asInt();
  digitalWrite(led4, led4State);

}

void temperature()
{
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);


  display.setCursor(0, 0);
  display.println("---------------------");
  display.setCursor(0, 6);
  display.print("|    Temperature    |");
  display.setCursor(0, 12);
  display.println("---------------------");

  display.setCursor(0, 16); // position 0
  display.println(" Interieur  |");
  display.print("---------------------");
  display.display();

  display.setCursor(0, 30); // position 1
  display.println(" Exterrieur |");
  display.print("---------------------");
  display.display();

  display.setCursor(0, 44); // position 2
  display.println(" Eau        |");
  display.print("---------------------");
  display.display();




  // Send command to all the sensors for temperature conversion
  sensors.requestTemperatures();

  // Display temperature from each sensor
  for (int i = 0;  i < deviceCount;  i++)
  {

    tempC = sensors.getTempCByIndex(i);
    Blynk.virtualWrite(i + 21, tempC);
    display.setCursor(80, lcd_position[i]);
    display.print(tempC);
    display.display();

  }
}

void checkPhysicalButtonAll()
{

void checkPhysicalButton1();
{
  if (digitalRead(btn1) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn1State != LOW) {

      // Toggle LED state
      relais1Sate = !relais1Sate;
      digitalWrite(relais1, relais1Sate);
      led1State = !led1State;
      digitalWrite(led1, led1State);

      // Update Button Widget
      Blynk.virtualWrite(V1, relais1Sate);
      Blynk.virtualWrite(V1, led1State);

    }
    btn1State = LOW;
  } else {
    btn1State = HIGH;
  }
}

void checkPhysicalButton2();
{
  if (digitalRead(btn2) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn2State != LOW) {

      // Toggle LED state
      relais2Sate = !relais2Sate;
      digitalWrite(relais2, relais2Sate);
      led2State = !led2State;
      digitalWrite(led2, led2State);

      // Update Button Widget
      Blynk.virtualWrite(V2, relais1Sate);
      Blynk.virtualWrite(V2, led1State);

    }
    btn2State = LOW;
  } else {
    btn2State = HIGH;
  }
}

void checkPhysicalButton3();
{
  if (digitalRead(btn3) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn3State != LOW) {

      // Toggle LED state
      relais3Sate = !relais3Sate;
      digitalWrite(relais3, relais3Sate);
      led3State = !led3State;
      digitalWrite(led3, led3State);

      // Update Button Widget
      Blynk.virtualWrite(V3, relais1Sate);
      Blynk.virtualWrite(V3, led1State);

    }
    btn3State = LOW;
  } else {
    btn3State = HIGH;
  }
}

void checkPhysicalButton4();
{
  if (digitalRead(btn4) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn4State != LOW) {

      // Toggle LED state
      relais4Sate = !relais4Sate;
      digitalWrite(relais4, relais4Sate);
      led4State = !led4State;
      digitalWrite(led4, led4State);

      // Update Button Widget
      Blynk.virtualWrite(V4, relais1Sate);
      Blynk.virtualWrite(V4, led1State);

    }
    btn4State = LOW;
  } else {
    btn4State = HIGH;
  }
}

}



void setup()
{
  sensors.begin();  // debut de la librairie capteur de température
  // Debug console
  Serial.begin(9600);
  WiFi.begin(ssid, pass);
  //timer.setInterval(3000L, checkBlynk); // check if connected to Blynk server every 3 seconds
  Blynk.config(auth);

  pinMode(relais1, OUTPUT);
  pinMode(btn1, INPUT_PULLUP);
  digitalWrite(relais1, relais1Sate);
  pinMode(led1, OUTPUT);

  pinMode(relais2, OUTPUT);
  pinMode(btn2, INPUT_PULLUP);
  digitalWrite(relais2, relais2Sate);
  pinMode(led2, OUTPUT);

  pinMode(relais3, OUTPUT);
  pinMode(btn3, INPUT_PULLUP);
  digitalWrite(relais3, relais3Sate);
  pinMode(led3, OUTPUT);

  pinMode(relais4, OUTPUT);
  pinMode(btn4, INPUT_PULLUP);
  digitalWrite(relais4, relais4Sate);
  pinMode(led4, OUTPUT);


  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }

  // Clear the buffer
  display.clearDisplay();
  display.display();


  timer.setInterval(100L,checkPhysicalButtonAll);

  timer.setInterval(10000L, temperature);

}



void loop()
{
  Blynk.run();
  timer.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

Your code doesn’t make any sense to me.

Pete.

could you detail this part a little more so that I understand better

One function which contains all of the code that is currently in your four functions.

Also, there’s no need for the debounce code when you’re scanning the buttons with a timer every 100ms.
You would need the debounce code if you were using interrupts though, which would be my preferred approach.

Pete.

A function for my four buttons, is that correct?

#define BLYNK_PRINT Serial


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

#include <SPI.h>
#include <Wire.h>

#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

BlynkTimer timer;

char auth[] = "xxxxxxxxxxxxxxxxxxx";

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

// Set your LED and physical button pins here
const int relais1 = 17;
const int btn1 = 25;
const int led1 = 33;

const int relais2 = 5;
const int btn2 = 26;
const int led2 = 32;


const int relais3 = 18;
const int btn3 = 27;
const int led3 = 35;

const int relais4 = 19;
const int btn4 = 14;
const int led4 = 34;

// one wire temperature
#define ONE_WIRE_BUS 23
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
int deviceCount = 3;
float tempC;






void checkPhysicalButton1();
void checkPhysicalButton2();
void checkPhysicalButton3();
void checkPhysicalButton4();
void temperature();


int relais1Sate = LOW;
int btn1State = HIGH;
int led1State = LOW;

int relais2Sate = LOW;
int btn2State = HIGH;
int led2State = LOW;

int relais3Sate = LOW;
int btn3State = HIGH;
int led3State = LOW;

int relais4Sate = LOW;
int btn4State = HIGH;
int led4State = LOW;

int lcd_position[] = {16, 30, 44}; // position temperature sur l'Ă©cran


BLYNK_WRITE(V1) {
  relais1Sate = param.asInt();
  digitalWrite(relais1, relais1Sate);
  led1State = param.asInt();
  digitalWrite(led1, led1State);

}

BLYNK_WRITE(V2) {
  relais2Sate = param.asInt();
  digitalWrite(relais2, relais2Sate);
  led2State = param.asInt();
  digitalWrite(led2, led2State);

}

BLYNK_WRITE(V3) {
  relais3Sate = param.asInt();
  digitalWrite(relais3, relais3Sate);
  led3State = param.asInt();
  digitalWrite(led3, led3State);

}

BLYNK_WRITE(V4) {
  relais4Sate = param.asInt();
  digitalWrite(relais4, relais4Sate);
  led4State = param.asInt();
  digitalWrite(led4, led4State);

}

void temperature()
{
  display.clearDisplay();
  display.display();
  display.setTextSize(1);
  display.setTextColor(SSD1306_WHITE);


  display.setCursor(0, 0);
  display.println("---------------------");
  display.setCursor(0, 6);
  display.print("|    Temperature    |");
  display.setCursor(0, 12);
  display.println("---------------------");

  display.setCursor(0, 16); // position 0
  display.println(" Interieur  |");
  display.print("---------------------");
  display.display();

  display.setCursor(0, 30); // position 1
  display.println(" Exterrieur |");
  display.print("---------------------");
  display.display();

  display.setCursor(0, 44); // position 2
  display.println(" Eau        |");
  display.print("---------------------");
  display.display();




  // Send command to all the sensors for temperature conversion
  sensors.requestTemperatures();

  // Display temperature from each sensor
  for (int i = 0;  i < deviceCount;  i++)
  {

    tempC = sensors.getTempCByIndex(i);
    Blynk.virtualWrite(i + 21, tempC);
    display.setCursor(80, lcd_position[i]);
    display.print(tempC);
    display.display();

  }
}



void checkPhysicalButton1()
{
  if (digitalRead(btn1) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn1State != LOW) {

      // Toggle LED state
      relais1Sate = !relais1Sate;
      digitalWrite(relais1, relais1Sate);
      led1State = !led1State;
      digitalWrite(led1, led1State);

      // Update Button Widget
      Blynk.virtualWrite(V1, relais1Sate);
      Blynk.virtualWrite(V1, led1State);

    }
    btn1State = LOW;
  } else {
    btn1State = HIGH;
  }

  if (digitalRead(btn2) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn2State != LOW) {

      // Toggle LED state
      relais2Sate = !relais2Sate;
      digitalWrite(relais2, relais2Sate);
      led2State = !led2State;
      digitalWrite(led2, led2State);

      // Update Button Widget
      Blynk.virtualWrite(V2, relais1Sate);
      Blynk.virtualWrite(V2, led1State);

    }
    btn2State = LOW;
  } else {
    btn2State = HIGH;
  }

  if (digitalRead(btn3) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn3State != LOW) {

      // Toggle LED state
      relais3Sate = !relais3Sate;
      digitalWrite(relais3, relais3Sate);
      led3State = !led3State;
      digitalWrite(led3, led3State);

      // Update Button Widget
      Blynk.virtualWrite(V3, relais1Sate);
      Blynk.virtualWrite(V3, led1State);

    }
    btn3State = LOW;
  } else {
    btn3State = HIGH;
  }

  if (digitalRead(btn4) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btn4State != LOW) {

      // Toggle LED state
      relais4Sate = !relais4Sate;
      digitalWrite(relais4, relais4Sate);
      led4State = !led4State;
      digitalWrite(led4, led4State);

      // Update Button Widget
      Blynk.virtualWrite(V4, relais1Sate);
      Blynk.virtualWrite(V4, led1State);

    }
    btn4State = LOW;
  } else {
    btn4State = HIGH;
  }
}





void setup()
{
  sensors.begin();  // debut de la librairie capteur de température
  // Debug console
  Serial.begin(9600);
  WiFi.begin(ssid, pass);
  //timer.setInterval(3000L, checkBlynk); // check if connected to Blynk server every 3 seconds
  Blynk.config(auth);

  pinMode(relais1, OUTPUT);
  pinMode(btn1, INPUT_PULLUP);
  digitalWrite(relais1, relais1Sate);
  pinMode(led1, OUTPUT);

  pinMode(relais2, OUTPUT);
  pinMode(btn2, INPUT_PULLUP);
  digitalWrite(relais2, relais2Sate);
  pinMode(led2, OUTPUT);

  pinMode(relais3, OUTPUT);
  pinMode(btn3, INPUT_PULLUP);
  digitalWrite(relais3, relais3Sate);
  pinMode(led3, OUTPUT);

  pinMode(relais4, OUTPUT);
  pinMode(btn4, INPUT_PULLUP);
  digitalWrite(relais4, relais4Sate);
  pinMode(led4, OUTPUT);


  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for (;;); // Don't proceed, loop forever
  }

  // Clear the buffer
  display.clearDisplay();
  display.display();


  timer.setInterval(100L,checkPhysicalButton1);

  timer.setInterval(10000L, temperature);

}



void loop()
{
  Blynk.run();
  timer.run();
  // You can inject your own code or combine it with other sketches.
  // Check other examples on how to communicate with Blynk. Remember
  // to avoid delay() function!
}

Yes.

However, your function has a very misleading name, still has the unnecessary debounce code for each button, and you are still pre-declaring the four functions…

Pre-declaring functions is unnecessary, and in my opinion makes the code less readable.

Pete.

1 Like

@PeteKnight thank you very much for your help