 }
 
 void play_song() {
+
+  digitalWrite(ledPin, LOW); 
   Serial.println("Playing song");
   for(int i = 0; i < sizeof(song_notes) / sizeof(int); ++i) {
-     if (song_notes[i] > 0) {
-       tone(SPEAKER_PIN, song_notes[i], song_lens[i] * note_rate);
+    
+    if (song_notes[i] > 0) {
+       digitalWrite(ledPin, HIGH);
+       tone(speakerPin, song_notes[i], song_lens[i] * note_rate);
+       
      }
-     delay(song_lens[i] * note_rate + 100); 
+     delay(song_lens[i] * note_rate);
+     digitalWrite(ledPin, LOW);
+     // Inter-note spacing
+     delay( 100); 
+    
   }
+  digitalWrite(ledPin, HIGH);
 }
 
 void loop() {
-  int buttonState = digitalRead(BUTTON_PIN);
+  int buttonState = digitalRead(buttonPin);
+  Serial.println(buttonState);
+
   if (buttonState == HIGH) {
-    play_song();
-    send_message();
+    delay(debounceDelay);
+    if(digitalRead(buttonPin) == HIGH) {
+      play_song();
+      send_message();
+    } else {
+      delay(debounceDelay);
+    }
+    
   }
  
 }

  0x90, 0xA2, 0xDA, 0x0D, 0xCC, 0x2D
};

const int SPEAKER_PIN = 6;
const int BUTTON_PIN = 2;

const char server_host[] = "ournewballandchain.com";
unsigned int server_port = 8008;

void setup() {
  // start the serial library:
  Serial.begin(9600);
    
  pinMode(ledPin, OUTPUT);
  pinMode(buttonPin, INPUT);
  
//  // start the Ethernet connection:
  int errEthernet = Ethernet.begin(mac);
  if (errEthernet == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    Serial.println(errEthernet);
    // no point in carrying on, so do nothing forevermore:
    while(true) {
       digitalWrite(ledPin, LOW);
       delay(1000);
       digitalWrite(ledPin, HIGH);
       delay(1000);
    }
  }
  Udp.begin(server_port);
  dnsClient.begin(Ethernet.dnsServerIP());
