Motor driver ST L298N Dual H bridge controlled with pot

Hi,

I've searched a topic about my question but i can't find anything. Now I try to explain my problem. :~

I want to control a DC motor (12V) with my driver Dual H bridge based on L298N chip.

http://www.robotshop.com/eu/seeedstudio-l298-dual-h-bridge-motor-driver.html

It is necessery for me a clockwise and anticlockwise rotation and delays. I connected Arduino with Dual H bridge and everything works well!

This is the sketch:

int pinl1=2; int pinl2=4; int speedpin=10;

void setup() {

pinMode(pinl1,OUTPUT); pinMode(pinl2,OUTPUT); pinMode(speedpin,OUTPUT); }

void loop() {

analogWrite(speedpin,1000); delay(5000); digitalWrite(pinl1,LOW); digitalWrite(pinl2,HIGH); analogWrite(speedpin,1000); delay(100000); digitalWrite(pinl1,HIGH); digitalWrite(pinl2,HIGH); delay(20000); digitalWrite(pinl1,HIGH); digitalWrite(pinl2,LOW); analogWrite(speedpin,1000); delay(20000); digitalWrite(pinl1,HIGH); digitalWrite(pinl2,HIGH); delay(20000); }

I don't want to regulate the motor speed only by programming, but If it's possible with a pot. I tried to control EA working on the PWM output 10 by pot (gnd, 5V, A0). It doesn't work!

is it the right way? What could it be the right sketch?

Thank you! :)

Enable is just what its name implies, when high the outputs are active, when low the outputs are HighZ. So to control via pot you will have to fashion a PWM of a hardware design that uses a pot for a control signal.

Thank you for the reply!

Do you have any idea about the hardware that i could use?

D1 is optional and is used to enforce a minimum off time when VR1 goes out of scope. Addition of a Diode across R5 with a smaller series resistor can be used to manipulate ramp symmetry giving more or less range of on state pulse width relative to VR1 wiper voltage.