Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 10 months ago.
Stop playing the song
Great lib, thanks.
I play a song in a loop, and the loop stops when the user press the button. Then the song plays until the end is reached. Is there a way to stop the song immediately when the button is pressed?
bool play = 1;
void playMusic() { Music* pMusic = new Music(s); while (play) { pMusic->play(&buzzer); } delete(pMusic); }
void pressed() { play = 0; }