************************CODIGO*************************
#include "pitches.h"
int melody[] = {
NOTE_C4, NOTE_D4, NOTE_E4, NOTE_F4, NOTE_G4, NOTE_A4, NOTE_B4 // Escala de DO
};
int i=1;
void setup() {
for(i;i<=128;i=i*2){
//Recorremos el vector con las notas de la escala de DO.
for (int thisNote = 0; thisNote < 7; thisNote++) {
int noteDuration = 1000 / i;
tone(8, melody[thisNote], noteDuration);
//Iniciamos la melodía con negras, luego se va duplicando la velocidad en cada iteración
int pauseBetweenNotes = noteDuration * 1.30;
delay(pauseBetweenNotes);
noTone(8);
//Agregamos una pausa entre las notas
}
}
}
void loop() {
// no repetimos la melodía.
}