int melody[] = {
396, 660, 594, 528, 495, 594,
528, 495, 440, 396, 440, 495,
528, 396, 528, 660, 792, 660,
528, 594, 792, 660, 594, 528,
660, 792, 660, 594, 528, 440,
495, 528, 440, 396, 594, 660,
704, 594, 440, 495, 528
};
int noteDurations[] = {
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4
};
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
for (int i = 0; i < sizeof(melody) / sizeof(melody[0]); i++) {
int noteDuration = 1000 / noteDurations[i];
tone(8, melody[i], noteDuration);
delay(noteDuration * 1.3);
noTone(8);
delay(50);
}
delay(10000);
}