#include "LedControl.h"
#define C4  262
#define D4  294
#define E4  330
#define F4  349
#define G4  392
int melody[] = {E4,D4,C4,D4,E4,E4,E4,D4,D4,D4,E4,G4,G4,
                E4,D4,C4,D4,E4,E4,E4,D4,D4,E4,D4,C4};
float beats[] ={1,1,1,1,1,1,2,1,1,2,1,1,2,1,
                1,1,1,1,1,2,1,1,1,1,4};
int buzzerpin = 11;
int timestop = 70;
LedControl lc=LedControl(8,10,9,1); 
// Pin 8->DIN, 10->CLK, 9->CS(LOAD), 1 = No.of devices
void setup() 
{
  lc.shutdown(0,false);  
  lc.setIntensity(0,5); 
  lc.clearDisplay(0);
  int dl = 250;
  pinMode(buzzerpin,OUTPUT);
  int numnote;
  numnote = sizeof(melody)/2;  
  for (int i=0;i<numnote;i++) 
  {
    lc.setDigit(0,0,beats[i],false);
    tone(buzzerpin, melody[i],dl*beats[i]);
    delay(dl*beats[i]);
    digitalWrite(buzzerpin,HIGH);
    delay(timestop);
  }
}
void loop() 
{
}


