How can i prepare sleep timer?

Hello everyone. I prepare program for my arduino project. It is music player. I wanna add 'sleep timer' function my program. Sleep timer is as you know from Spotify, It'll stop your music after you sleep. Yeah l know it is complicated but i need just when i press button1 then count 30 minute then send 'sleep' command to Hc-o5 bluetooth module (call BluetoothClient1 send text). I am able to connect bluetooth and send another signal or anything but i dont know how can i make minute counter and when minute == 0 then send command. If you help me, I'll so glad. Thanks. Regards Farhad

Please search for countdown here in the community to find some solutions...

Also you might have to keep your app up and running until sleeping time... one solution for this is to use the KeepScreenOn method from the tools extension 404 Not Found | Pura Vida Apps

Taifun


Thanks, Taifun, I do like this. İs it correct? Are there logic mistakes? Now i can't check the program therefore i ask you

By the way, i did some researchs. I dont need to keep my screen awake. Because my music player work just command. For example when i click the button, it'll send '1' command that time arduino play music from sd card

You might want to subtract by 1...
Taifun

Try this:

blocks