trouble shooting

I have tried to connect the arduino with the h-bridge connected to the dc motor. Using the connections defined by the program below, but its not running the dc motor.

My sketch

#define motorpin1 2
#define motorpin2 3
#define motorpin3 4
#define motorpin4 5
#define enablepin 8

void setup() {
pinMode(motorpin1, OUTPUT);
pinMode(motorpin2, OUTPUT);
pinMode(motorpin3, OUTPUT);
pinMode(motorpin4, OUTPUT);

// set speedPin high so that motor can turn on:
digitalWrite(enablepin, HIGH);
}

void loop() {
digitalWrite(motorpin1, LOW);
digitalWrite(motorpin2, HIGH);
digitalWrite(motorpin3, LOW);
digitalWrite(motorpin4, HIGH);
delay(500);
digitalWrite(motorpin1, LOW);
digitalWrite(motorpin2, LOW);
digitalWrite(motorpin3, LOW);
digitalWrite(motorpin4, LOW);
}

What type of H-bridge are you using?

Hi Anachrocomputer,

Am using a pololu MD03A 12 volt dc h-bridge. Am not sure of the grd connection from the h-bridge. Am sure that the hardware are okey!

Don't cross post it's not nice.

did you remember to connect Arduinos ground to the H bridge ground ?

Hi MikMo,
I have grounded the h-bridge at the arduino power pin and at the same time tappes a +5 from the arduino. Or should i ground it on the digital pin of the arduino?

Connect the Ground pin of the Arduino to the Ground (or 0V) pin of the H-bridge.

You might also want to follow the advice of another poster (in the other thread) and add another 500ms delay at the end of "loop()".

I have managed to move my dc motor!! The peroblem was simply that i had missed to connect the pwm from the h-bridge to the pwm of the arduino.