bluetooth serial communication dosn't works properly

I want to when pressing button send data to slav bluetooth and run my some other staff. the first code is working but when I add some extra code and I press button. serial monitor for slav bluetooh doesn't respond

BluetoothSerial.write is working

 if(currentHalfStep != LastHalfStep){
if(currentHalfStep == HIGH){
   delay(100);
   BluetoothSerial.write('C');
   Serial.println("half step button clicked"); 


  }
  delay(50);
}

LastHalfStep = currentHalfStep;

BluetoothSerial.write is not working

if(currentHalfStep != LastHalfStep){
if(currentHalfStep == HIGH){
   delay(100);
   BluetoothSerial.write('C');
   Serial.println("half step button clicked"); 
   changeCount(2);  // added function

  }
  delay(50);
}

LastHalfStep = currentHalfStep;

changeCount(2);

What's going on there?

hi, when I write any function serial write doesn't work. for this example my function was below. it is not related to function, for any other function it is not working.

for example ı tried below countNumber function it is a basic function. problem continued. however when ı remove these functions. everything is okey

void changeCount(int number){
       
       
        if(a){
          shiftCount = shiftCount + number;
          Serial.println(shiftCount);
          }else {
            shiftCount = shiftCount - number;
            Serial.println(shiftCount);
            }
        
    }
void countNumber(){
 shiftCount = shiftCount + 4;
 }

Please provide complete code which compiles, runs, and demonstrates the problem.

What is the slave code?