Linear Actuator is not working with BTS7960

I am trying to run linear actuator with BTS7960 motor driver and Arduino UNO. But, the code seems fine, wiring seems fine but after uploading the code, the linear actuator does not start.
I am using two push buttons to extend and retract the actuator.

The code is shown below:
byte mspeed=0;
int RPWM = 5;
int LPWM = 6;

void setup() {
// put your setup code here, to run once:
pinMode(2, INPUT_PULLUP);
pinMode(4, INPUT_PULLUP);
pinMode(13, OUTPUT);


void loop() {
// put your main code here, to run repeatedly:
if( digitalRead(2) == LOW & digitalRead(4) == HIGH ){
mspeed = 255;
analogWrite(LPWM, mspeed);
else if( digitalRead(2) == HIGH & digitalRead(4) == LOW ){
mspeed = 255;
analogWrite(LPWM, 0);
analogWrite(LPWM, 0);


I am following the given below circuit diagram and using 12V DC power supply

The easier you make it to read and copy the code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

You have a Serial.begin, but no prints to get your sketch to tell you what it is doing.

Please remember to use code tags when posting code.

Also, & is bitwise AND, but you need logical AND, which is &&

I didn't expect it to, but it is an important distinction to make and learn about.

Now, about the debug prints...

I take it you haven't added any debug prints yet.

Fix that first.

Don't try to debug wearing oven mitts, with ear defenders on, and all the lights turned off.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.