user63923: I verified my code and uploaded it to the board and that was successful.
Info: 
  - Using Mega 2560 Arduino Board with Adafruit V1 
  - 3 DC 12 volt motors 
  - on HP computer
Here is my code:
#include <AFMotor.h>

AF_DCMotor motor(1, MOTOR12_8KHZ);
AF_DCMotor motor2(2, MOTOR12_8KHZ);
AF_DCMotor motor3(2, MOTOR12_1KHZ);

void setup()  {
  Serial.begin(9600);
  Serial.println("Motor Test!");
  motor.setSpeed(20); //set speed of motor
  motor2.setSpeed(20); //set speed of motor
  motor3.setSpeed(25); //set speed of motor     
}

void loop() {
  Serial.print("tick");
  motor.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor.run(RELEASE);
  delay(5000);

  Serial.print("tack"); //first song starts 
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor.run(RELEASE);
  delay(14000);

  Serial.print("tack"); 
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //first song ends
  motor.run(RELEASE);
  delay(13000);

  Serial.print("tick");
  motor.run(FORWARD);
  delay(2000);

  Serial.print("tock"); //second song starts 
  motor.run(RELEASE);
  delay(24000);

  Serial.print("tick");
  motor.run(FORWARD);
  delay(2000);

  Serial.print("tock"); //second song ends 
  motor.run(RELEASE);
  delay(17000);

   Serial.print("tick");
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //third song starts 
  motor.run(RELEASE);
  delay(23000);

  Serial.print("tick");
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //third song ends 
  motor.run(RELEASE);
  delay(21000);

  Serial.print("tick");
  motor.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor.run(RELEASE);
  delay(5000);

  Serial.print("tick");
  motor.run(FORWARD);
  delay(3000);

  Serial.print("tack"); //fourth song starts 
  motor.run(RELEASE);
  delay(5000);

  Serial.print("tack"); 
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //fourth song ends
  motor.run(RELEASE);
  delay(21000);
   //waving motor
  Serial.print("tick"); 
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(5000);

  //Waving motor
  Serial.print("tick"); //first song starts
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

   Serial.print("tock");
  motor2.run(FORWARD);
  delay(1000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //first song ends
  motor2.run(RELEASE);
  delay(14000);

  Serial.print("tick"); 
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(5000);

  Serial.print("tack"); //SEcond song starts
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

   Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //second song ends
  motor2.run(RELEASE);
  delay(15000);


  Serial.print("tick"); 
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(5000);

  Serial.print("tack"); //Third song starts
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

   Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tock"); //third song ends
  motor2.run(RELEASE);
  delay(14000);

  Serial.print("tick"); //fourth song starts
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

   Serial.print("tock");
  motor2.run(FORWARD);
  delay(1000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //fourth song ends
  motor2.run(RELEASE);
  delay(7000);

  //dancing motor
  Serial.print("tock"); //first song starts
  motor3.run(RELEASE);
  delay(11000);

  Serial.print("tick"); 
  motor3.run(FORWARD);
  delay(22000);

  Serial.print("tock"); //first song stops //second song starts
  motor3.run(RELEASE);
  delay(16000);

    Serial.print("tick"); //Second song stops
  motor3.run(FORWARD);
  delay(28000);

  Serial.print("tock"); //Third song starts
  motor3.run(RELEASE);
  delay(15000);

  Serial.print("tick"); //Third song stops
  motor3.run(FORWARD);
  delay(33000);

  Serial.print("tock"); //fourth song starts
  motor3.run(RELEASE);
  delay(16000);

  Serial.print("tick"); 
  motor3.run(FORWARD);
  delay(5000);

  Serial.print("tock");
  motor3.run(RELEASE);
  delay(1000);

  Serial.print("tick"); //fourth song ends
  motor3.run(FORWARD);
  delay(16000);

  Serial.print("tock");
  motor3.run(RELEASE);
  delay(5000);
}


user64075: As you did not give details I assume the following:

You supply the MEGA via USB or external 5-12V power supply
the motors are supplied via an extra external 12V power supply with sufficiant amperage
All cabeling is checked and correct

Looks like this schematic (without 12V power supply attached to the motor shield)


To your code:

Get rid of the delay()s - they block processing so what happens:
 motor.run(FORWARD);  // => You give a command via lib
 delay(2000); // You stop your processing so the motor is not running


so you have two options both need the definition of a timeStamp var

working with a (blocking) while loops
or creating a finite state machine (search here on SO for details)

So I will for simplicity use the first approach
 // Copy this var before your setup
 unsigned long timeStamp = 0;
// use your complete setup 
 void setup(){...}
 // Change your loop functions like thes first three converted lines 
 void loop(){
  timeStamp = millis();
  Serial.print("tick");
  while(millis()-timeStamp < 2000){     
     motor.run(FORWARD);
  }   
  timeStamp = millis();   // resets the time to current
  Serial.print("tock");
  while(millis()-timeStamp < 5000){     
     motor.run(RELEASE);
  }
  timeStamp = millis();   // resets the time to current
  Serial.print("tack"); //first song starts 
  while(millis()-timeStamp < 2000){   
     motor.run(BACKWARD);
  }
// .... AND SO ON .....
}

Be aware that the whiles are blocking but for your sequential processing its ok.

63923: <p><a href="https://i.stack.imgur.com/M3e0o.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M3e0o.jpg" alt="enter image description here"></a><a href="https://i.stack.imgur.com/aAU02.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aAU02.jpg" alt="enter image description here"></a><a href="https://i.stack.imgur.com/sk6xd.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sk6xd.jpg" alt="enter image description here"></a><a href="https://i.stack.imgur.com/Y8ZEO.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y8ZEO.jpg" alt="enter image description here"></a><a href="https://i.stack.imgur.com/k7WQg.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/k7WQg.jpg" alt="enter image description here"></a>I verified my code and uploaded it to the board and that was successful.</p>

<p>Info: 
  - Using Mega 2560 Arduino Board with Adafruit V1 
  - 3 DC 12 volt motors 
  - on HP computer</p>

<p>Here is my code:</p>

<pre><code>#include &lt;AFMotor.h&gt;

AF_DCMotor motor(1, MOTOR12_8KHZ);
AF_DCMotor motor2(2, MOTOR12_8KHZ);
AF_DCMotor motor3(2, MOTOR12_1KHZ);

void setup()  {
  Serial.begin(9600);
  Serial.println("Motor Test!");
  motor.setSpeed(20); //set speed of motor
  motor2.setSpeed(20); //set speed of motor
  motor3.setSpeed(25); //set speed of motor     
}

void loop() {
  Serial.print("tick");
  motor.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor.run(RELEASE);
  delay(5000);

  Serial.print("tack"); //first song starts 
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor.run(RELEASE);
  delay(14000);

  Serial.print("tack"); 
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //first song ends
  motor.run(RELEASE);
  delay(13000);

  Serial.print("tick");
  motor.run(FORWARD);
  delay(2000);

  Serial.print("tock"); //second song starts 
  motor.run(RELEASE);
  delay(24000);

  Serial.print("tick");
  motor.run(FORWARD);
  delay(2000);

  Serial.print("tock"); //second song ends 
  motor.run(RELEASE);
  delay(17000);

   Serial.print("tick");
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //third song starts 
  motor.run(RELEASE);
  delay(23000);

  Serial.print("tick");
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //third song ends 
  motor.run(RELEASE);
  delay(21000);

  Serial.print("tick");
  motor.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor.run(RELEASE);
  delay(5000);

  Serial.print("tick");
  motor.run(FORWARD);
  delay(3000);

  Serial.print("tack"); //fourth song starts 
  motor.run(RELEASE);
  delay(5000);

  Serial.print("tack"); 
  motor.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //fourth song ends
  motor.run(RELEASE);
  delay(21000);
   //waving motor
  Serial.print("tick"); 
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(5000);

  //Waving motor
  Serial.print("tick"); //first song starts
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

   Serial.print("tock");
  motor2.run(FORWARD);
  delay(1000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //first song ends
  motor2.run(RELEASE);
  delay(14000);

  Serial.print("tick"); 
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(5000);

  Serial.print("tack"); //SEcond song starts
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

   Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //second song ends
  motor2.run(RELEASE);
  delay(15000);


  Serial.print("tick"); 
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(5000);

  Serial.print("tack"); //Third song starts
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

   Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tock"); //third song ends
  motor2.run(RELEASE);
  delay(14000);

  Serial.print("tick"); //fourth song starts
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(BACKWARD);
  delay(2000);

   Serial.print("tock");
  motor2.run(FORWARD);
  delay(1000);

  Serial.print("tick");
  motor2.run(RELEASE);
  delay(1000);

  Serial.print("tick");
  motor2.run(FORWARD);
  delay(2000);

  Serial.print("tack"); 
  motor2.run(BACKWARD);
  delay(2000);

  Serial.print("tock"); //fourth song ends
  motor2.run(RELEASE);
  delay(7000);

  //dancing motor
  Serial.print("tock"); //first song starts
  motor3.run(RELEASE);
  delay(11000);

  Serial.print("tick"); 
  motor3.run(FORWARD);
  delay(22000);

  Serial.print("tock"); //first song stops //second song starts
  motor3.run(RELEASE);
  delay(16000);

    Serial.print("tick"); //Second song stops
  motor3.run(FORWARD);
  delay(28000);

  Serial.print("tock"); //Third song starts
  motor3.run(RELEASE);
  delay(15000);

  Serial.print("tick"); //Third song stops
  motor3.run(FORWARD);
  delay(33000);

  Serial.print("tock"); //fourth song starts
  motor3.run(RELEASE);
  delay(16000);

  Serial.print("tick"); 
  motor3.run(FORWARD);
  delay(5000);

  Serial.print("tock");
  motor3.run(RELEASE);
  delay(1000);

  Serial.print("tick"); //fourth song ends
  motor3.run(FORWARD);
  delay(16000);

  Serial.print("tock");
  motor3.run(RELEASE);
  delay(5000);
}
</code></pre>
 64075: <p>As you did not give details I assume the following:</p>

<ul>
<li>You supply the MEGA via USB or external 5-12V power supply</li>
<li>the motors are supplied via an extra external 12V power supply with sufficiant amperage</li>
<li>All cabeling is checked and correct</li>
</ul>

<p>Looks like this schematic (without 12V power supply attached to the motor shield)
<a href="https://i.stack.imgur.com/4jF1P.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4jF1P.jpg" alt="AF_motor_shield_v1"></a>
<a href="https://i.stack.imgur.com/toMGU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/toMGU.jpg" alt="AF_Motor_shield_v2"></a></p>

<p>To your code:</p>

<ul>
<li><p>Get rid of the delay()s - they block processing so what happens:</p>

<pre><code> motor.run(FORWARD);  // =&gt; You give a command via lib
 delay(2000); // You stop your processing so the motor is not running
</code></pre></li>
</ul>

<p>so you have two options both need the definition of a timeStamp var</p>

<ul>
<li>working with a (blocking) while loops</li>
<li>or creating a finite state machine (search here on SO for details)</li>
</ul>

<p>So I will for simplicity use the first approach</p>

<pre><code> // Copy this var before your setup
 unsigned long timeStamp = 0;
// use your complete setup 
 void setup(){...}
 // Change your loop functions like thes first three converted lines 
 void loop(){
  timeStamp = millis();
  Serial.print("tick");
  while(millis()-timeStamp &lt; 2000){     
     motor.run(FORWARD);
  }   
  timeStamp = millis();   // resets the time to current
  Serial.print("tock");
  while(millis()-timeStamp &lt; 5000){     
     motor.run(RELEASE);
  }
  timeStamp = millis();   // resets the time to current
  Serial.print("tack"); //first song starts 
  while(millis()-timeStamp &lt; 2000){   
     motor.run(BACKWARD);
  }
// .... AND SO ON .....
}
</code></pre>

<p>Be aware that the whiles are blocking but for your sequential processing its ok.</p>
