Hello , i am using an L298N motor to power 2 hobby gear motors. The program has been borrowed from a website to simply test the motors , and i have used several programs to troubleshoot if its a software issue , but it seems to be a hardware issue. If i get one of the digital pins for ENA or ENB and hold a wire from it onto a jumper on ENA or ENB , that sides motor will start spinning , but i am unsure as to if it is possible to either use the motor with the jumpers on and have it still work , or how to get it working without the jumpers.
Image and code included below ;
int motor1pin1 = 2;
int motor1pin2 = 3;
int motor2pin1 = 4;
int motor2pin2 = 5;
void setup() {
// put your setup code here, to run once:
pinMode(motor1pin1, OUTPUT);
pinMode(motor1pin2, OUTPUT);
pinMode(motor2pin1, OUTPUT);
pinMode(motor2pin2, OUTPUT);
//(Optional)
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
//(Optional)
}
void loop() {
// put your main code here, to run repeatedly:
//Controlling speed (0 = off and 255 = max speed):
//(Optional)
analogWrite(9, 100); //ENA pin
analogWrite(10, 200); //ENB pin
//(Optional)
digitalWrite(motor1pin1, HIGH);
digitalWrite(motor1pin2, LOW);
digitalWrite(motor2pin1, HIGH);
digitalWrite(motor2pin2, LOW);
delay(3000);
digitalWrite(motor1pin1, LOW);
digitalWrite(motor1pin2, HIGH);
digitalWrite(motor2pin1, LOW);
digitalWrite(motor2pin2, HIGH);
delay(3000);
}
