0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« on: March 25, 2009, 05:58:55 pm » |
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); }
|
|
|
|
|
Logged
|
|
|
|
|
Bristol, UK
Offline
Edison Member
Karma: 0
Posts: 1197
Exhibitor at UK Maker Faire
|
 |
« Reply #1 on: March 26, 2009, 04:53:42 am » |
What type of H-bridge are you using?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #2 on: March 26, 2009, 07:07:50 am » |
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!
|
|
|
|
|
Logged
|
|
|
|
|
Manchester (England England)
Offline
Brattain Member
Karma: 277
Posts: 25506
Solder is electric glue
|
 |
« Reply #3 on: March 26, 2009, 08:41:32 am » |
Don't cross post it's not nice.
|
|
|
|
|
Logged
|
|
|
|
|
Copenhagen / Denmark
Offline
Edison Member
Karma: 5
Posts: 2338
Do it !
|
 |
« Reply #4 on: March 26, 2009, 11:20:14 am » |
did you remember to connect Arduinos ground to the H bridge ground ?
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #5 on: March 27, 2009, 07:25:47 am » |
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?
|
|
|
|
|
Logged
|
|
|
|
|
Bristol, UK
Offline
Edison Member
Karma: 0
Posts: 1197
Exhibitor at UK Maker Faire
|
 |
« Reply #6 on: March 27, 2009, 08:40:44 am » |
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()".
|
|
|
|
« Last Edit: March 27, 2009, 08:41:52 am by anachrocomputer »
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 27
Arduino rocks
|
 |
« Reply #7 on: March 28, 2009, 02:19:04 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
|