Motor Troubles

Hello All,

I am trying to run two dc motors off an Arduino connected to an L298N. I’m using pushbuttons wired to the analog pins with resistors to control the direction of each motor. I have the Arduino wired to my computer and the L298N powered by a 12v battery supply.

My issue is that only one motor is working and only in one direction. Meaning only one button is working on that motor, and neither button works on the other motor. I know the correct voltage values are getting back to the analog pins because I have the serial monitor reading me those values. I also know that both motors are fully functional through other testing. Am I not using a big enough power supply? And if so, why is only one motor running in one direction? Or is my code incorrect? I have attached a picture of my setup and the code I am using.

Thanks!

TwoPins.ino (1.79 KB)

Please read the advicing topics "How to use the Forum", How to attach code".
I don't like filling up my Pc with all stuff from OPs.
Produce a proper schematic if You want accurate answers.

Image from Original Post so we don't have to download it. See this Simple Image Posting Guide

...R

A photo of the hardware does not provide a reliable guide to how everything is connected. Just make a simple pencil drawing showing all the connections and post a photo of the drawing.

...R