Hm... the time delay is quite variable:
#define EN_1 9
#define EN_2 10
#define M1_A 7
#define M1_B 8
#define M2_A 11
#define M2_B 12
void setup() {
analogWrite(EN_1, 255);
analogWrite(EN_2, 255);
pinMode(M1_A, OUTPUT);
pinMode(M1_B, OUTPUT);
digitalWrite(M1_A, HIGH);
digitalWrite(M1_B, LOW);
pinMode(M2_A, OUTPUT);
pinMode(M2_B, OUTPUT);
digitalWrite(M2_A, HIGH);
digitalWrite(M2_B, LOW);
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(13, HIGH);
digitalWrite(M1_A, HIGH);
digitalWrite(M1_B, LOW);
digitalWrite(M2_A, HIGH);
digitalWrite(M2_B, LOW);
}
It continuously writes the values out. I think a lot of you are forgetting the problem doesn't appear when using an external supply, so I think it must be something to do with the regulator?