Hello dear arduino guys,
I have an Uno R3 and try to rotate a motor in both directions but it behave weird.
The curcuit is like this http://www.arduino-tutorial.de/motorsteuerung-mit-einem-h-bridge-ic/
I just changed the pins a little bit, so I can connect a third motor with a transistor.
11 is for pwm and it works fine, it change the speed.
If pin 12 is HIGH and 13 LOW the motor moves normally but if pin 12 is LOW and 13 is HIGH it wont move, but it should move in the other direction.
if both 12 and 13 are HIGH it moves in the opposite direction but much slower.
I am actually totally confused and dont find an answer.
Besides the motor needs a lot voltage so i cuttet the ends of a 12v charger and connected it instead of the batterie.
Here is the code if you need it
#define E1 10 // Enable Pin for motor 1
#define E2 11 // Enable Pin for motor 2
#define I1 8 // Control pin 1 for motor 1
#define I2 9 // Control pin 2 for motor 1
#define I3 12 // Control pin 1 for motor 2
#define I4 13 // Control pin 2 for motor 2
#define I5 3 //Motor 3
void setup() {
pinMode(E1, OUTPUT);
pinMode(E2, OUTPUT);
pinMode(I1, OUTPUT);
pinMode(I2, OUTPUT);
pinMode(I3, OUTPUT);
pinMode(I4, OUTPUT);
pinMode(I5, OUTPUT);
}
void loop()
{
analogWrite(E1, 200);
analogWrite(E2, 250);
//Does not rotate
digitalWrite(I3, LOW);
digitalWrite(I4, HIGH);
delay(1000);
//works
digitalWrite(I3, HIGH);
digitalWrite(I4, LOW);
delay(1000);
//Rotates in the opposite direction but slower than it should
digitalWrite(I3, HIGH);
digitalWrite(I4, HIGH);
delay(1000);
}