 
 void play_song(int song_number)
 {
+  int note_length = 0;
+  
   // 26 notes long
   for ( int i = 0; i < 26; i++ )
   {
-    if ( song_number == 0 )
+    if ( song_number == 0 || song_number > 0 )
     {
-      int note_length = 1000 / mary_had_a_little_lamb_lengths[i];
+      note_length = 1000 / mary_had_a_little_lamb_lengths[i];
       tone(speakerPin, mary_had_a_little_lamb_notes[i], note_length);
     }
     

  photocell_reading = analogRead(photocell_pin);
  Serial.print("Analog reading = ");
  Serial.print(photocell_reading);
  // Commented out because it's unneeded debugging information.
  // Serial.print(", ");
  // Serial.println(normal_light_flag);

  // When it gets bright or dark, make a sound.
  // Stop playing the sound until it's normal lighting out again.
  if ( photocell_reading >= 700 && photocell_reading <= 710 )
  {
    normal_light_flag = 1;
  }

  if ( photocell_reading < 700 && normal_light_flag )
  {
    play_song(0);
    normal_light_flag = 0;
  }
  else if ( photocell_reading > 710 && normal_light_flag )
  {
    for ( int i = 0; i < 4; i++ )
    {

#include <Adafruit_PWMServoDriver.h>
#include <Wire.h>
#include "pitches.h"

// **************************
// **** PROXIMITY SENSOR ****
// **************************
// i2c address
#define VCNL4000_ADDRESS 0x13

// commands and constants
#define VCNL4000_COMMAND 0x80
#define VCNL4000_PRODUCTID 0x81
#define VCNL4000_IRLED 0x83
#define VCNL4000_AMBIENTPARAMETER 0x84
#define VCNL4000_AMBIENTDATA 0x85
#define VCNL4000_PROXIMITYDATA 0x87
#define VCNL4000_SIGNALFREQ 0x89
#define VCNL4000_PROXIMITYADJUST 0x8A

#define VCNL4000_3M125 0
#define VCNL4000_1M5625 1
#define VCNL4000_781K25 2
#define VCNL4000_390K625 3

#define VCNL4000_MEASUREAMBIENT 0x10
#define VCNL4000_MEASUREPROXIMITY 0x08
#define VCNL4000_AMBIENTREADY 0x40
#define VCNL4000_PROXIMITYREADY 0x20

uint16_t ambient_reading = 0;
uint16_t proximity_reading = 0;

// **********************
// **** SERVO SHIELD ****
// **********************
// Uses the default address 0x40.
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();

// These are the minimum and maximum pulse length counts (out of 4096).
#define BIG_SERVO_MIN 160
#define BIG_SERVO_MAX 584
#define MICRO_SERVO_MIN 160
