 
 
   // Iterate through both buzzers
-  for (unsigned int i = 0; i < 2; i++)
+  for (unsigned int i = 0; i < NUMBER_OF_BUZZERS; i++)
   {
 
     // Check if it's time for the buzzer to stop

    {
      // Once the opcode is verified, send data about the arduino
      Serial.println(MAX_MUSIC_LEN);
      
      // Immediately following the opening OPcode should be a short detailing
      // how many notes there are for the first buzzer
      Serial.readBytes(dat, 2);
      
      // Get the length of the music and buffer that many x2 bytes (one byte
      // for pitch, one for duration) into the music array
      music_length[0] = *(unsigned short*)&dat[0];
      Serial.readBytes((byte*)&Music[0][0], music_length[0]*2);


      // After loading all the music, reset the buzzers and internal cursors
      buzzer_target[0]  = 0;
      buzzer_target[1]  = 0;
      music_pos[0]      = 0;
      music_pos[1]      = 0;
    }
    
  }

#include <Tone.h>
#include "Notes.cpp"

#define MAX_MUSIC_LEN 400
#define NUMBER_OF_BUZZERS 2


// Create two tone controllers
Tone buzzer[2];

// Holds the time when the buzzers should play to
unsigned long buzzer_target[NUMBER_OF_BUZZERS];


// The "cursor" for each of the buzzers
unsigned int music_pos[NUMBER_OF_BUZZERS];
// Holds the length of the music
unsigned int music_length[NUMBER_OF_BUZZERS];


// Defines the music
Note Music[NUMBER_OF_BUZZERS][MAX_MUSIC_LEN];



void setup()
{
  // Here we initiallize our piezo buzzers, on pins 8+
  for (unsigned int i = 0; i < NUMBER_OF_BUZZERS; i++)
    buzzer[i].begin(8+i);

  // Creates a Serial connection
  Serial.begin(9600);
