How to turn off music on arduino

Hi,
I would like to play music on arduino usimg sd card and controlles it with a phone app through bluetooth. Meaning, arduino is connected to the app with bluetooth connection, when i press the music button on the app, arduino will play the music and when i press the Off button on the app, the music will be stopped.
I was able to write the code on arduino and connect the bluetooth to the app and make the music play when i press the music button on the app. My problem is that i didn’t find how to stop the music, i didn’t know what code should i read on arduino program to be able to turn off the music when i press the Off button on the App. I attached a picture of the code that i use. Can anyone help me please









@Soumeya25, please do not cross-post. Other thread removed.

Three more cross posts deleted. This is your last warning. If you do it again, I'm going to suspend your account.

Gotta say I'm impressed you manage to post images in this forum as newcomer, but too bad you completely failed to read or follow the instructions of the main forum sticky, which a.o. tells you how to properly post code, and what else we need for informed help.

wvmarle:
Gotta say I'm impressed you manage to post images in this forum as newcomer...

wvmarle:
Last Edit: Aug 19, 2019, 05:01 pm by Coding Badly

:wink:

Right :slight_smile:

TMRpcm audio;
audio.play("filename"); plays a file
audio.play("filename",30); plays a file starting at 30 seconds into the track
audio.speakerPin = 11; set to 5,6,11 or 46 for Mega, 9 for Uno, Nano, etc.
audio.disable(); disables the timer on output pin and stops the music
audio.stopPlayback(); stops the music, but leaves the timer running
audio.isPlaying(); returns 1 if music playing, 0 if not
audio.pause(); pauses/unpauses playback
audio.quality(1); Set 1 for 2x oversampling
audio.volume(0); 1(up) or 0(down) to control volume
audio.setVolume(0); 0 to 7. Set volume level
audio.loop(1); 0 or 1. Can be changed during playback for full control of looping.

It seems to me that you want stopPlayback.