How to enable the motor to run in both the directions?

Hey guys,

So I’ve been working on my final year project, and a part of the project relates to controlling the speed of the DC motor. Now, I have achieved controlling the speed of the motor in only one direction using a joystick (using only 1 axis right now, if I turn the stick left, it rotates clockwise with increasing speed). If I turn right, it should theoretically rotate anticlockwise. But practically, it’s not.

I’m using L293D as my motor driver, it has an H-Bridge which moves the motor in either direction.

Here is the circuit diagram : https://imgur.com/a/QRp8ESc

Here is the link to the Arduino code : https://pastebin.com/j9eZPvW2

TL;DR – For some unknown reasons to me, I’m unable to figure out how to rotate the motor in both the directions with the L293D motor driver.

submitted by /u/yeohap
[link] [comments]