void takeon(){ lcd.setCursor(0,0); lcd.scrollDisplayLeft(); delay(1000); // Creado por Robson Couto, 2019 . extraido de https://github.com/robsoncouto/arduino-songs for (int thisNotedos = 0; thisNotedos < notesdos * 2; thisNotedos = thisNotedos + 2) { lcd.print(" TAKE ON ME "); // calculates the duration of each note dividerdos = melodydos[thisNotedos + 1]; if (dividerdos > 0) { // regular note, just proceed noteDurationdos = (wholenotedos) / dividerdos; } else if (dividerdos < 0) { // dotted notes are represented with negative durations!! noteDurationdos = (wholenotedos) / abs(dividerdos); noteDurationdos *= 1.5; // increases the duration in half for dotted notes } // we only play the note for 90% of the duration, leaving 10% as a pause tone(buzzerdos, melodydos[thisNotedos], noteDurationdos * 0.9); // Wait for the specief duration before playing the next note. delay(noteDurationdos); // stop the waveform generation before the next note. noTone(buzzerdos); } }