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