I'm trying to control the speed of two motors with a code I found on the internet, in the beginning I was able to control the speed of the two motors and they'd spin at the same time but after a couple of days they don't want to spin, I have to spin a little bit the rotor shaft so they start spinning
#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
void setup() {
pinMode(E1, OUTPUT);
pinMode(E2, OUTPUT);
pinMode(I1, OUTPUT);
pinMode(I2, OUTPUT);
pinMode(I3, OUTPUT);
pinMode(I4, OUTPUT);
}
void loop() {
analogWrite(E1, 153);
analogWrite(E2, 153);
digitalWrite(I1, HIGH);
digitalWrite(I2, LOW);
digitalWrite(I3, HIGH);
digitalWrite(I4, LOW);
}
Here's the schematic diagram of the circuit that I used http://hardwarefun.com/tutorials/controlling-speed-of-dc-motors-using-arduino
The only difference between that circuit and mine is that my Arduino is connected to the computer and I didn't use the battery, therefore I'm not using pin 8 of the I.C or Vin from Arduino, strangely both motors work with the speed of 255, but not with 153.
It was working fine a couple of days ago, what could possible have gone wrong? Please I need help