Debouncing left and right boutons

Hello, guys I am experiencing some problem with compiling this code in FUNCTIONS tab:

//boolean antirebondsSWdroite(interDroit){ // UPLODABLE IF COMMENTED / SAYS nterDroit was not declared in the scope IF COMMENTED
//boolean EtatSWD=HIGH;                    // declared in the scope IF COMMENTED
//static byte registre;
//EtatSWD = digitalRead(interDroit);
//registre = decalageDroite(registre, EtatSWD);
//if((registre && B00001111) == B00000000) //Regarde si bouton appuyé
//EtatSWD = LOW;	//Si oui, état BAS
//else
//EtatSWD = HIGH; //Si non, état HAUT (PULLUP !)
//Serial.println(EtatSWD);
//return EtatSWD;

The whole sketch is (in tab "RobotReboundFiltre"):

const int ledPin=12;  //une del s'allume lorsque le niveau des interrupteurs est à HIGH
const int interGauche=3;//déclaration d'interrupteur droit sur la broche #3 
const int interDroit=2; //déclaration d'interrupteur droit sur la broche #2
boolean EtatSWG=HIGH; //initialise l'état d'interrupteur #1 (gauche) à HIGH
boolean EtatSWD=HIGH; //initialise l'état d'interrupteur #2 (droit) à HIGH

void setup(){
Serial.begin(9600);                //9600 boud, soit 9600 bits/sec
pinMode(interGauche,INPUT_PULLUP); //lorsque l'intérrupteur est branché avec un bout de fil sur la broche numérique et l'autre bout est branché sur le GRND. Le niveau logique est HIGH lorsque l'interrupteur est ouvert.     
pinMode(interGauche,INPUT_PULLUP); //lorsque l'intérrupteur est branché avec un bout de fil sur la broche numérique et l'autre bout est branché sur le GRND. Le niveau logique est HIGH lorsque l'interrupteur est ouvert.     
pinMode(ledPin,OUTPUT);
}

void loop(){
  
//  registreSWgauche=decalageGauche(registreSWgauche, EtatSWG);
//  registreSWdroite=decalageGauche(registreSWdroite, EtatSWD);
  
  afficheEtatSWgauche(EtatSWG); // Displays a state of the left SW 
  afficheEtatSWdroite(EtatSWD);  //  Displays a state of the right SW
  
  EtatSWG=digitalRead(interGauche); //lit l'état de l'interrupteur gauche et enregistre la valeur dans la //variable locale EtatSW1 
  EtatSWD=digitalRead(interDroit);  //lit l'état de l'interrupteur droit et enregistre la valeur dans la //variable locale EtatSW2 

  
  digitalWrite(ledPin,EtatSWD||EtatSWG);  // LED indicates if switches are ON or OFF
  delay(500);
}

(in tab "Functions")

//Routine pour implanter un registre à décalage
byte decalageGauche(byte registre, boolean valeurInseree){
registre = registre << 1;	      //Déplace tous les bits de 1 bit vers la gauche
bitWrite(registre, 0, valeurInseree); //Insère la val. bool. dans D0
return registre;
}

boolean antirebondsSWgauche(int interGauche){
boolean EtatSWG=HIGH;
static byte registre;
EtatSWG = digitalRead(interGauche);
registre = decalageGauche(registre, EtatSWG);
if((registre && B00001111) == B00000000) //Regarde si bouton appuyé
EtatSWG = LOW;	//Si oui, état BAS
else
EtatSWG = HIGH; //Si non, état HAUT (PULLUP !)
Serial.print(EtatSWG);
return EtatSWG;
}

//boolean antirebondsSWdroite(interDroit){ // UPLODABLE IF COMMENTED / SAYS interDroit was not 
//boolean EtatSWD=HIGH;                       // declared in the scope IF COMMENTED
//static byte registre;
//EtatSWD = digitalRead(interDroit);
//registre = decalageDroite(registre, EtatSWD);
//if((registre && B00001111) == B00000000) //Regarde si bouton appuyé
//EtatSWD = LOW;	//Si oui, état BAS
//else
//EtatSWD = HIGH; //Si non, état HAUT (PULLUP !)
//Serial.println(EtatSWD);
//return EtatSWD;
//}                                        

void afficheEtatSWgauche(boolean etatPresentSWgauche){
static boolean etatPrecedentSWgauche;
etatPresentSWgauche = !etatPresentSWgauche;
if(etatPresentSWgauche == HIGH && etatPrecedentSWgauche == LOW){
Serial.print("Bouton gauche appuy"); Serial.write(233);Serial.println();
}
else if(etatPresentSWgauche == LOW && etatPrecedentSWgauche == HIGH){
Serial.print("Bouton gauche rel");
Serial.write(226); Serial.print("ch");Serial.write(233);Serial.println();
}
etatPrecedentSWgauche = etatPresentSWgauche;
}

void afficheEtatSWdroite(boolean etatPresentSWdroite){
  static boolean etatPrecedentSWdroite;
  etatPresentSWdroite=!etatPresentSWdroite;
  if(etatPresentSWdroite==HIGH && etatPrecedentSWdroite==LOW){
  Serial.print("Bouton droit appuy"); Serial.write(233);Serial.println();
  }
else if(etatPrecedentSWdroite==LOW && etatPrecedentSWdroite==HIGH){
Serial.print("Bouton droite rel");
Serial.write(226); Serial.print("ch");Serial.write(233);Serial.println();  
}
etatPrecedentSWdroite = etatPresentSWdroite;
}

P.S The left bouton is perfectly compilable, the only problem is to get working the right bouton.

In setup you have two left buttons Try this

void setup(){
Serial.begin(9600);                //9600 boud, soit 9600 bits/sec
pinMode(interGauche,INPUT_PULLUP); //lorsque l'intérrupteur est branché avec un bout de fil sur la broche numérique et l'autre bout est branché sur le GRND. Le niveau logique est HIGH lorsque l'interrupteur est ouvert.     
pinMode(interDroit,INPUT_PULLUP); //lorsque l'intérrupteur est branché avec un bout de fil sur la broche numérique et l'autre bout est branché sur le GRND. Le niveau logique est HIGH lorsque l'interrupteur est ouvert.     
pinMode(ledPin,OUTPUT);
}

It's not working as the same...

if((registre && B00001111) == B00000000) //Regarde si bouton appuyé
Maybe you want
if((registre & B00001111) == B00000000) //Regarde si bouton appuyé
This looks very odd, what are you trying to do here?

LarryD:
if((registre && B00001111) == B00000000) //Regarde si bouton appuyé
Maybe you want
if((registre & B00001111) == B00000000) //Regarde si bouton appuyé
This looks very odd, what are you trying to do here?

looks like left, right top AND bottom, but he only has two buttons.

I do have only two buttons and their state is compared to register. Globally it's watching if a switch is toggled.

if((registre && B00001111) == B00000000) //Regarde si bouton appuyé
&& logical AND
& Bitwise AND