Bluetooth communication issue

Hi ! Please, can anyone help me? I’m building a car controlled by bluetooth. I’m using two bluetooth modules, one HC 05 and the other HC 06. The HC 05 is the master and the HC 06 is the slave.At the moment, I’m doing tests with Leds.

my problem is: if I turn on the leds 1 and 2 and momentarily release the led2, when I try to turn the led2 on again, it does not light, only the led1 is still on. To turn the two leds back on, I need to release the two leds. I would like the leds to light up simultaneously whenever I press the buttons.

How can I fix this problem?

below is the program code.

Transmitter Code:

 #include <SoftwareSerial.h>

SoftwareSerial BTMasterHC05(2, 3); 
 
#define button1 4
#define button2 5
#define button3 6

void setup() {
  Serial.begin(9600);
  BTMasterHC05.begin(9600);
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
pinMode(button3, INPUT_PULLUP);
}
 

void loop() {


String Out = "";
  int length = 1; 
   
  if (BTMasterHC05.available()){
    Serial.write( BTMasterHC05.read());
 }

  if (Serial.available()){
    BTMasterHC05.write(Serial.read());
  }
 
 
  if (digitalRead(button1)==LOW) {
    Out = Out + "A";
    length = length + 1;

  }
   if (digitalRead(button2)==LOW) {
    Out = Out + "B";
    length = length + 1;

}
  
  if (digitalRead(button3)==LOW) {

    Out = Out + "C";
    length = length + 1;

  } 


char outData[length];
  Out.toCharArray(outData, length);
BTMasterHC05.write(outData);
Serial.write(outData);

if(digitalRead(button1)==HIGH &&  digitalRead(button2)==HIGH && digitalRead(button3)==HIGH){
BTMasterHC05.write('p');
Serial.write('p');

}

}

Receiver Code:

#define pin1 A0
#define pin2 A1
#define pin3 A2

boolean led1 = false; 
boolean led2 = false;
boolean led3 = false;

char statusLed =0;
// -------------------------------------------------------

void setup()
{
  
  pinMode(pin1, OUTPUT);
  pinMode(pin2, OUTPUT);
  pinMode(pin3, OUTPUT);
    
digitalWrite(pin1, HIGH);
digitalWrite(pin2, HIGH);
digitalWrite(pin3, HIGH);
  Serial.begin(9600);
  
}

// -------------------------------------------------------

void loop()
{
  
      while (Serial.available()){
      statusLed = Serial.read();
        Serial.print(statusLed);
    } 
   
 
   
     

  
     if( statusLed == 'A'  )               
  {
led1 = true; 
 
}
 if( statusLed == 'B'  )               
  {
led2 = true; 
}

 if( statusLed == 'C'  )               
  {
  led3 = true;
  }
 
 if(statusLed == 'p'  )               
  {
 led1 = false; 
 led2 = false;
 led3 = false;
   }


 if(led1){
digitalWrite(pin1, HIGH); 

}
 if(led2){
digitalWrite(pin2, HIGH); 

}

 if(led3){
digitalWrite(pin3, HIGH); 

}


 if(!led1){
digitalWrite(pin1, LOW); 

}
 if(!led2){
digitalWrite(pin2, LOW); 

}

 if(!led3){
digitalWrite(pin3, LOW); 

}



}

Thank you.