// Declaración de los pines del piezo eléctrico y la duración de cada nota
const int buzzerPin = 8;
const int notes[] = {NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4, NOTE_C5, NOTE_B4, NOTE_A4, NOTE_G4, NOTE_F4, NOTE_E4, NOTE_D4};
const int durations[] = {200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200};
void setup() {
pinMode(buzzerPin, OUTPUT);
}
void loop() {
for (int i = 0; i < 14; i++) {
playNote(notes[i], durations[i]);
}
}
void playNote(int note, int duration) {
tone(buzzerPin, note, duration);
delay(duration);
noTone(buzzerPin);
delay(50); // Breve pausa entre notas
}