Mehrere Inputs debouncen

Fr33man:

Bounce debounce1 = Bounce();

Bounce debounce2 = Bounce();
...

debounce1.attatch(button1);
debounce2.attatch(button2);
...

Das erscheint logisch, funktionieren tut es aber nicht. Im SerialMonitor schreibt er dann "HLHLHLHLHL".

Hier nochmal mein angepasster Code, habe ich noch einen Fehler verbaut?

#include <Bounce2.h>

#define buttonPin3 11
#define buttonPin1 10
#define buttonPin2 13


// Instantiate a Bounce object
Bounce debounce1 = Bounce(); 
Bounce debounce2 = Bounce();


//const int buttonPin = 12;     // the number of the pushbutton pin
int buttonState = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin1, INPUT);
  pinMode(buttonPin2, INPUT);
  
  digitalWrite(buttonPin1,HIGH);
  digitalWrite(buttonPin2,HIGH);
  
  debounce1.attach(buttonPin1);
  debounce1.interval(5);
 
  debounce2.attach(buttonPin2);
  debounce2.interval(5);
  
  //Setup the LED
  pinMode(buttonPin3,OUTPUT);
  

}

void loop(){
buttonState = digitalRead(buttonPin1);
if (buttonState == HIGH) {
    Serial.print("H");
}
else {
    Serial.print("L");

}
buttonState = digitalRead(buttonPin2);
if (buttonState == HIGH) {
    Serial.print("H");
}
else {
    Serial.print("L");

}
 // Update the debouncer
  debounce1.update();
  debounce2.update();
 
 // Get the update value
 int value = debounce1.read();
 
 // Turn on or off the LED
 if ( value == HIGH) {
   digitalWrite(buttonPin3, HIGH );
 } else {
    digitalWrite(buttonPin3, LOW );
 }
 int value2 = debounce2.read();
  if ( value2 == HIGH) {
   digitalWrite(buttonPin3, HIGH );
 } else {
    digitalWrite(buttonPin3, LOW );
 }

}