1 // From: http://garagelab.com/profiles/blogs/how-to-use-tone-function-arduino-playing-the-james-bond-theme
4 #define NO_SOUND 0 // make the rests in music
8 /*NOTE_G4,NOTE_G4,NO_SOUND,NOTE_G4,NOTE_G4,NO_SOUND,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,
9 NOTE_B3,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_CS4,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_B3,NOTE_G3,NOTE_C4,NOTE_G3,NOTE_CS4,NOTE_G3,NOTE_C4,NOTE_G3,
10 NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
11 NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,*/
13 NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
14 NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
15 NOTE_E4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_F4,NOTE_E4,NOTE_E4,NOTE_E4,
16 NOTE_E4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_G4,NOTE_E4,NOTE_E4,NOTE_E4,
17 NOTE_DS5,NOTE_D5,NOTE_B4,NOTE_A4,NOTE_B4,
18 NOTE_E4,NOTE_G4,NOTE_DS5,NOTE_D5,NOTE_G4,NOTE_B4,
19 NOTE_B4,NOTE_FS5,NOTE_F5,NOTE_B4,NOTE_D5,NOTE_AS5,
20 NOTE_A5,NOTE_F5,NOTE_A5,NOTE_DS6,NOTE_D6,NO_SOUND
23 // note duration: 1 = whole note, 2 = half note, 4 = quarter note, 8 = eighth note, etc.
24 int noteDurations[] = {
25 /*8,8,2,8,8,2,16,8,16,8,8,
26 2,4,2,4,2,4,2,4,2,4,2,4,2,4,2,4,
39 int pace = 1450; // change pace of music("speedy")
41 for (int Note = 0; Note <54; Note++) {//counter of Notes (54 limit the array)
42 int duration = pace/noteDurations[Note];//Adjust duration with the pace of music
43 tone(9, melody[Note],duration); //Play note
45 // to distinguish the notes, set a minimum time between them.
51 //to repeat song, push reset button.