Simple Program Fails

I don’t know if this is hardware or the program. Seems very simple.

I’ve attached the hardware picture.

Pins 6 and 7 (yellow wires) on the Uno board go to the In1 and In2 on the l298n. Power GND on the l298 is connect to GND on the Uno board. I have 12v power going into the 12v power and Power GND on the l298n. MotorA Enable has a jumper to enable. The wires on MotorA go to the motor; which I’ve tested and know it works.

The project is more complicated, but here is some simpler code I’ve written to test it and it won’t go.

const boolean SerialDisplay = true;
void setup() {

Serial.begin(9600); // initialize serial port hardware

if (SerialDisplay) {
Serial.println(" Processes running:");
}

pinMode (6, OUTPUT); // motor close direction pin = output
pinMode (7, OUTPUT); // motor open direction pin = output

}

void closeCoopDoorMotorA() {
digitalWrite (7, HIGH); // turn on motor close direction
digitalWrite (6, LOW); // turn off motor open direction
}

void doCoopDoor() {
closeCoopDoorMotorA(); // close the door
}

void loop() {
closeCoopDoorMotorA();
}

Yes, I a newbie so, please, be patient.

I appreciate any help and suggestions.

BR

it looks like you are using a H bridge as a relay in the picture. I do not see a separate power source connected to the H bridge. I see wires to the motor and 3 wires to the arduino and I know the arduino can not power the motor so I figure you are missing something.

Ok, the effect of this sketch will be to put a high on 7 and a low on 6.

If that is what is supposed to close the door, and the door is not closing, then:

1) test if 7 really is high and 6 really is low. Just pop a LED on the pin.

2) test if giving the board 5v on 7 and ground on 6 turns the motor. Just stuff the wires into ground and Vcc.

I see two logic wires coming off the board to the arduino, two wires going to the motor, and an earth wire. I don't see any other power going to the external board. You are aware that the whole point of these boards is that you can't power a motor off the arduino? That you need an external power supply and a way to control it, and that's what these boards do?

When all else fails divide and conquer.
First, try to get the LM298 working without the Arduino.
Next, verify the Outputs on the Ardiuno are working.
Finally, hook the two together and then it should work.

Sometimes you need to determine what is working,
to determine what is not working.
What do know for sure, is working?

You title states, “Simple Program Fails”
But is it the “Program / Arduino” or is it the “L298N”?

Please draw a schematic and attach it.
It is difficult to see the +12v / GND / +5V connections.

Also, use the “</>” button to format your code.