explanation needed

can some one please explain me this code !! and i wanna include bluetooth control for this motor !!
how can it be done ?

int RPWM=5;
int LPWM=6;
int L_EN=7;
int R_EN=8;

 void setPWMfrequency(int freq){
  TCCR0B = TCCR0B & 0b11111000 | freq ;
 }

 void MotorActiveStatus(char Side,boolean s){
   boolean state=s;
   if(Side=='R'){
   digitalWrite(R_EN,s);
   }
   if(Side=='L'){
   digitalWrite(L_EN,s);
   }    
 }
 void setMotor(char side,byte pwm){
  if(side=='R'){
   analogWrite(RPWM,pwm);
  }
   if(side=='L'){
   analogWrite(LPWM,pwm);
  }
 }
 void closeMotor(char side){
    if(side=='R'){
   digitalWrite(RPWM,LOW);
    }
    if(side=='L'){
   digitalWrite(LPWM,LOW);
    }

    }
void setup() 

{
 // put your setup code here, to run once:
 setPWMfrequency(0x02);// timer 0 , 3.92KHz
 
 for(int i=5;i<9;i++){
  pinMode(i,OUTPUT);
 }
  for(int i=5;i<9;i++){
  digitalWrite(i,LOW);
 }
  delay(1000);
  MotorActiveStatus('R',true);
  MotorActiveStatus('L',true);
   Serial.begin(9600);
 }

void loop() {
 // put your main code here, to run repeatedly:

for(int i=0;i<256;i++){

 setMotor('R',i);
 delay(500);
}

delay(1000);
closeMotor('R');
delay(1000);

 for(int i=0;i<256;i++){
 setMotor('L',i);
 delay(500);
}

delay(1000);
closeMotor('L');
delay(1000);
}

Please modify your post and use the code button </> so your code looks like this and is easy to copy to a text editor. Then I will be study it.

If you don't understand the code I presume you got it from somewhere - where? (post a link)

What do you think the code does?
You must have some idea if you know you need to change it?

Have you tried the code?
What happened?

...R

yeah actually this is to control a 12 v 5a motor forward and revers !!

and this code works forward and reverse with loop but i want it controlled by Bluetooth

here is the link that i got this code !!

i have the same h bridge module BTS 7960 43 A
thanks

Start by writing a program that takes the instructions from the Serial Monitor. When you have that working it will be simple to add on the Bluetooth device as that is just serial-by-wireless.

You may find something useful in Serial Input Basics. The system in the 3rd example is the most reliable.

The Thread Planning and Implementing a Program may also be of interest.

...R