Driving a linear actuator with bts7960

I have a linear actuator with specs of 24V 3A, need to run the actuator at full capacity, need a motor driver to drive the actuator forward and backward, so I tried to create a circuit with l298n. Still, its current value is limited with 2A. Now I have decided to use the bts7960 motor driver with a higher amper value, but its schematic is more complex than l298n. I am a new Arduino learner, so I am confused about some parts of Arduino coding and motor driver connections.
I have connected the actuator and power supply to the bts7960. And other pin connections are;
Gnd-Gnd(on Arduino)
Vcc-5v
RPWM=5
LPWM=6
L_EN=7
R_EN=8
I have also 3 buttons and 1 led. Buttons are connected to 11 12 13 pins on Arduino and led is connected to pin 9.
My aim is to drive the motor with inputs taken from buttons. Led should light up while the motor is moving.

Arduino coding
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
int button1=0;
int button2=0;
int button3=0;
int counter=0;
int RPWM=5;
int LPWM=6;
int L_EN=7;
int R_EN=8;
int led=9;
void setup(){
pinMode(13,INPUT);
pinMode(12,INPUT);
pinMode(11,INPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
for(int i=5; i<9;i++){
digitalWrite(i,LOW);
}
delay(500);
Serial.begin(9600);
digitalWrite(R_EN,HIGH);
digitalWrite(L_EN,HIGH);
}
void forward(){
analogWrite(LPWM,0);
analogWrite(RPWM,255);
digitalWrite(9,HIGH);
}
void backward(){
analogWrite(RPWM,0);
analogWrite(LPWM,255);
digitalWrite(9,HIGH);
}
void stop_(){
analogWrite(RPWM,0);
analogWrite(LPWM,0);
digitalWrite(9,LOW);
}

void loop(){
button1=digitalRead(13);
button2=digitalRead(12);
button3=digitalRead(11);

if (button1==1){
counter=1;
}
if (button2==1){
counter=2;
}
if (button3==1){
counter=3;
}
if(counter==1) forward ();
if(counter==2) backward ();
if(counter==3) stop_ ();
delay(100);
}
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
However, after completing the movement in the forward or backward direction actuator will stop automatically, but the led is still open according to coding. How can I correct it? Can I use L_is and R_is pins of bts 7960 in order to measure the current? (i have no idea about these pins)Can I define an analogRead for these pins in coding part ? Then I can light up the led when the current value is above a specific value.
Measuring the duration and assigning a delay command to coding part is not a solution for my actuator, since I will apply a force to the actuator so the duration will change wrt applied force.
I have also worried about whether there is any mistake in my coding part.


I hope the picture explains the circuit well.
THANK YOU…

If you look at the data sheet, which you have not linked to, you will probably see that the actuator has built in limit switches to stop the movement so it can save itself from being destroyed.

Please edit your post to add code tags ("</>" editor button).

Thank you for your response, but my problem is not about limiting movement. I know it limits motion at a certain distance. I can not control the led appropriately and i am not sure about coding part, since I did not get bts 7960 yet, so I have limited time to create the circuit and try it.

What LED? How is it connected? What is it supposed to do? Without a schematic you won't get much of an answer. If you have limited time, make the most of it and begin to supply schematic, block diagrams, etc.

I will supply a schematic, but I did not find a software that includes bts7960 (like tinkercad ), so I tried my best and supply 2 images about what I am going to do.

Pencil and paper work just as well and take a usable picture and post it!

Uploaded the schematic, can you look at it now?

Yes, I see the LED and I see your program does nothing with the LED. If you have questions about pins on the controller, you need to see a data sheet/documentation on the controller. You asked a bunch of questions about stuff on the controller that only you can answer, since I can not see the information you have.

thank you.