user38687: I am trying to operate two DC motors at once using a L293D chip. I have managed to control them however, one of the motors has a slight problem. Whenever I start the program (attached below), one of the motor (I tried switching them, it isn't a problem due to the motor itself) has a counterclockwise spin for a second before starting to spin clockwise as it is suppose to. When it is spinning counterclockwise, the other motor is not doing any movements.
Is something wrong in the code or in the circuit? (I've also attached a hyperlink to my circuit which I found online, as well as my code) 
Thank you
#define E1 11  // Enable Pin for motor 1
#define E2 10  // Enable Pin for motor 2
#define I1 12  // Control pin 1 for motor 1
#define I2 13  // Control pin 2 for motor 1
#define I3 8   // Control pin 1 for motor 2
#define I4 9   // 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, 255); // Run at full speed
  analogWrite(E2, 255); // Run at full speed
  digitalWrite(I1, HIGH);
  digitalWrite(I2, LOW);
  digitalWrite(I3, HIGH);
  digitalWrite(I4, LOW);
  delay(4500);
  // change direction
  digitalWrite(E1, LOW);
  digitalWrite(E2, LOW);
  delay(2000000000000);
  analogWrite(E1, 255);  // Run at full speed
  analogWrite(E2, 255);  // Run at full speed
  digitalWrite(I1, LOW);
  digitalWrite(I2, HIGH);
  digitalWrite(I3, LOW);
  digitalWrite(I4, HIGH);
  delay(000);
}

http://hw.sudarmuthu.com/wp-content/uploads/sites/2/2013/06/basic-bot1.png

user37523: I'm having trouble compiling your code Max. It's failing on this line: delay(2000000000000);
The last line of code: delay(000); doesn't seem to be doing anything useful and can be removed.
I do not have a L293D IC to test the following code with so I need you to test it for me please.
#define E1 11  // Enable Pin for motor 1
#define E2 10  // Enable Pin for motor 2

#define I1 12  // Control pin 1 for motor 1
#define I2 7   // Control pin 2 for motor 1 (change pin 13 to pin 7)
#define I3 8   // Control pin 1 for motor 2
#define I4 9   // 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);

  // Disable motors
  digitalWrite(E1, LOW);
  digitalWrite(E2, LOW);
}

void loop() {

    // Set direction first
    digitalWrite(I1, HIGH);
    digitalWrite(I2, LOW);
    digitalWrite(I3, HIGH);
    digitalWrite(I4, LOW);

    // Enable motors
    analogWrite(E1, 255);
    analogWrite(E2, 255);

    // Motors run for 4.5 seconds
    delay(4500);

    // change direction

    // Disable motors
    digitalWrite(E1, LOW);
    digitalWrite(E2, LOW);

    // Give the motors time to stop if required
    delay(500);

    // Change motor direction
    digitalWrite(I1, LOW);
    digitalWrite(I2, HIGH);
    digitalWrite(I3, LOW);
    digitalWrite(I4, HIGH);

    // Enable motors
    analogWrite(E1, 255);
    analogWrite(E2, 255);

    // Motors run for 4.5 seconds
    delay(4500);

    // Disable motors
    digitalWrite(E1, LOW);
    digitalWrite(E2, LOW);

    // Give the motors time to stop if required
    delay(500);
}


user4143: #define I2 13  // Control pin 2 for motor 1

Pin 13 is the LED and is blinked by the bootloader. You will have to use a different pin for your motor.

38687: <p>I am trying to operate two DC motors at once using a L293D chip. I have managed to control them however, one of the motors has a slight problem. Whenever I start the program (attached below), one of the motor (I tried switching them, it isn't a problem due to the motor itself) has a counterclockwise spin for a second before starting to spin clockwise as it is suppose to. When it is spinning counterclockwise, the other motor is not doing any movements.</p>

<p>Is something wrong in the code or in the circuit? (I've also attached a hyperlink to my circuit which I found online, as well as my code) </p>

<p>Thank you</p>

<pre><code>#define E1 11  // Enable Pin for motor 1
#define E2 10  // Enable Pin for motor 2
#define I1 12  // Control pin 1 for motor 1
#define I2 13  // Control pin 2 for motor 1
#define I3 8   // Control pin 1 for motor 2
#define I4 9   // 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, 255); // Run at full speed
  analogWrite(E2, 255); // Run at full speed
  digitalWrite(I1, HIGH);
  digitalWrite(I2, LOW);
  digitalWrite(I3, HIGH);
  digitalWrite(I4, LOW);
  delay(4500);
  // change direction
  digitalWrite(E1, LOW);
  digitalWrite(E2, LOW);
  delay(2000000000000);
  analogWrite(E1, 255);  // Run at full speed
  analogWrite(E2, 255);  // Run at full speed
  digitalWrite(I1, LOW);
  digitalWrite(I2, HIGH);
  digitalWrite(I3, LOW);
  digitalWrite(I4, HIGH);
  delay(000);
}
</code></pre>

<p><a href="http://hw.sudarmuthu.com/wp-content/uploads/sites/2/2013/06/basic-bot1.png" rel="nofollow noreferrer">http://hw.sudarmuthu.com/wp-content/uploads/sites/2/2013/06/basic-bot1.png</a></p>
 37523: <p>I'm having trouble compiling your code Max. It's failing on this line: delay(2000000000000);</p>

<p>The last line of code: delay(000); doesn't seem to be doing anything useful and can be removed.</p>

<p>I do not have a L293D IC to test the following code with so I need you to test it for me please.</p>

<pre><code>#define E1 11  // Enable Pin for motor 1
#define E2 10  // Enable Pin for motor 2

#define I1 12  // Control pin 1 for motor 1
#define I2 7   // Control pin 2 for motor 1 (change pin 13 to pin 7)
#define I3 8   // Control pin 1 for motor 2
#define I4 9   // 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);

  // Disable motors
  digitalWrite(E1, LOW);
  digitalWrite(E2, LOW);
}

void loop() {

    // Set direction first
    digitalWrite(I1, HIGH);
    digitalWrite(I2, LOW);
    digitalWrite(I3, HIGH);
    digitalWrite(I4, LOW);

    // Enable motors
    analogWrite(E1, 255);
    analogWrite(E2, 255);

    // Motors run for 4.5 seconds
    delay(4500);

    // change direction

    // Disable motors
    digitalWrite(E1, LOW);
    digitalWrite(E2, LOW);

    // Give the motors time to stop if required
    delay(500);

    // Change motor direction
    digitalWrite(I1, LOW);
    digitalWrite(I2, HIGH);
    digitalWrite(I3, LOW);
    digitalWrite(I4, HIGH);

    // Enable motors
    analogWrite(E1, 255);
    analogWrite(E2, 255);

    // Motors run for 4.5 seconds
    delay(4500);

    // Disable motors
    digitalWrite(E1, LOW);
    digitalWrite(E2, LOW);

    // Give the motors time to stop if required
    delay(500);
}
</code></pre>
 4143: <pre><code>#define I2 13  // Control pin 2 for motor 1
</code></pre>

<p>Pin 13 is the LED and is blinked by the bootloader. You will have to use a different pin for your motor.</p>
