Control speed motor

When i use this code and connect a jumper to Enable in the H-bridge on a PWM pin
the motor doesn’t work at all
but when i put the capsule on the enable pin to disable the speed control it works fine with the maximum speed

#include <SoftwareSerial.h>
SoftwareSerial HC05(2,3) ;
String data ;
int Data;
int R_Forward = A0;
int R_Backward = A1;
int L_Forward =  A3;
int L_Backward = A2;

int Speed_R = 5;
int Speed_L = 6;
int Speed = 180;

void setup() {
 Serial.begin (9600) ;
 HC05.begin (9600) ;
 
 //Right wheel
 pinMode (R_Forward,OUTPUT) ;
 pinMode (R_Backward,OUTPUT) ;
 pinMode (Speed_R , OUTPUT );
 //Left wheel
 pinMode (L_Forward,OUTPUT) ;
 pinMode (L_Backward,OUTPUT) ;
  pinMode (Speed_L , OUTPUT );
}

void loop() {
  
  if (HC05.available()>0) {
   data = HC05.readString();
    Data = data.toInt();
//  Serial.println (Data);
  } 

 switch (Data)
      {
        case 1:
               Forward ();
               Serial.println("Forward");
                  break;
        case 2:
   Right ();
              // Left ();
               Serial.println("Left");
                  break;
}


void Forward(){
    analogWrite (Speed_R,Speed);
    digitalWrite (R_Forward,HIGH) ;
    digitalWrite (R_Backward,LOW) ;
    digitalWrite (L_Forward,HIGH) ;
    digitalWrite (L_Backward,LOW) ;
    analogWrite (Speed_R,Speed);
    analogWrite (Speed_L,Speed);
      }
void Left(){
    digitalWrite (R_Forward,HIGH) ;
    digitalWrite (R_Backward,LOW) ;
    digitalWrite (L_Forward,LOW) ;
    digitalWrite (L_Backward,LOW) ;
    analogWrite (Speed_R,Speed);
    analogWrite (Speed_L,Speed);
      }

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

What motor controller are you using?
Have you got the gnd of the Arduino connected to the gnd of the motor controller?
What model Arduino are you using?

Thanks.. Tom... :slight_smile:

The image is here

Hi,
OPs Pic.

What motor controller are you using?

What model Arduino are you using?

Tom... :slight_smile: