#include "pitches.h"
int melody[] = {
NG4,NE5,ND5,NC5,NG4,NG4,NE5,ND5,NC5,NA4,
NA4,NF5,NE5,ND5,NB4,NG5,NG5,NF5,ND5,NE5,
NG4,NE5,ND5,NC5,NG4,NG4,NE5,ND5,NC5,NA4,
NA4,NF5,NE5,ND5,NG5,NG5,NG5,NG5,NG5,NA5,NG5,NF5,ND5,NC5,NG5,
NE5,NE5,NE5,NE5,NE5,NE5,NE5,NG5,NC5,ND5,NE5,
NF5,NF5,NF5,NF5,NF5,NF5,NE5,NE5,NE5,NE5,NE5,ND5,ND5,NE5,ND5,NG5,
NE5,NE5,NE5,NE5,NE5,NE5,NE5,NG5,NC5,ND5,NE5,
NF5,NF5,NF5,NF5,NF5,NF5,NE5,NE5,NE5,NE5,NG5,NG5,NF5,ND5,NC5,
};
int noteDurations[] = {
8,8,8,8,2,8,8,8,8,2, // 10
8,8,8,8,2,8,8,8,8,2, // 10
8,8,8,8,2,8,8,8,8,2, // 10
8,8,8,8,8,8,8,16,16,8,8,8,8,4,4, // 15
8,8,4,8,8,4,8,8,8,8,2, // 11
8,8,8,16,16,8,8,8,16,16,8,8,8,8,4,4, // 16
8,8,4,8,8,4,8,8,8,8,2, // 11
8,8,8,16,16,8,8,8,16,16,8,8,8,8,2, // 15
};
void setup()
{
int MaxNote=sizeof(melody)/sizeof(int);
for (int thisNote = 0; thisNote <MaxNote; thisNote++)
{
int noteDuration = 1000/noteDurations[thisNote];
tone(8, melody[thisNote],noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(8);
}
}
void loop()
{
// no need to repeat the melody.
}