Control DC with pot

I want to control a DC motor with a potentiometer, Arduino and L298N motor driver. I want the system to be if i move the pot clockwise the dc motor will also rotate as much the pot have rotated.and if i rotate the pot counter cw the DC would also rotate that much ccw.

Now i want the code for this setup.
Thanks in advance :slight_smile:

If you really mean that when you move the potentiometer e.g. 75 degrees you expect the motor to rotate through 75 degrees then it would be a lot easier to do it with a servo rather than a plain DC motor. Moving to specified positions is what servos are made for and they have their own built-in drivers so you wouldn't need the L298N driver.

DC motors just spin round and round, they have no positioning ability so you'd need to get into encoders and other complexities.


Control DC with pot

The hippies tried that back in the day - it didn't work :slight_smile:


AC-DC were simply uncontrollable back then...... :o :o

Now i want the code for this setup.

Even if what you want to do were possible (see posts above) the way to get help here is first to post the code you tried that didn't work, then ask for help with specific issues, not demand "i [sic] want the code".