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! :)