Unfortunately it didn’t work – I don’t know if someone else has tested it and it works? But I’m sure that it keeps reseting here prv_selection=selection in the loop function.
Is there a function that reports when the track has finished playing so that I reset the track number? And then do something like this:
if (buttonIn == 1){
MP3player.stopTrack();
MP3player.playTrack(1);
}
if (buttonIn == 2){
MP3player.stopTrack();
MP3player.playTrack(2);
}
Look at my GIST example MP3ButtonPlayer.ino
I just threw it together, it does compile and should (???) work. I have not tested it at this moment. Where as it is very simple. And uses the Bounce Library to make Debouncing easy.