#define BUZZER_PIN 4
int notes[] = {262, 262, 392, 392, 440, 440, 392,
349, 349, 330, 330, 294, 294, 262,
392, 392, 349, 349, 330, 330, 294,
392, 392, 349, 349, 330, 330, 294,
262, 262, 392, 392, 440, 440, 392,
349, 349, 330, 330, 294, 294, 262
};
int duration[] = {300, 300, 300, 300, 300, 300, 500,
300, 300, 300, 300, 300, 300, 500,
300, 300, 300, 300, 300, 300, 500,
300, 300, 300, 300, 300, 300, 500,
300, 300, 300, 300, 300, 300, 500,
300, 300, 300, 300, 300, 300, 500
};
void setup() {
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
for (int i = 0; i < sizeof(notes) / sizeof(notes[0]); i++) {
tone(BUZZER_PIN, notes[i], duration[i]);
delay(duration[i] * 1.3);
}
noTone(BUZZER_PIN);
delay(2000);
}