Home › Forums › Sparkfun MP3 Shield Library Support Forum › MP3 Loop › Reply To: MP3 Loop
August 29, 2013 at 9:59 am
#2926
Michael P. Flaga
Member
prehaps, something like the following, where it is up to you get define getselection();
setup{
if(!sd.begin(SD_SEL, SPI_HALF_SPEED)) sd.initErrorHalt();
if(!sd.chdir("/")) sd.errorHalt("sd.chdir");
MP3player.begin();
prv_selection = selection;
}
loop{
selection = getselection();
if (()selection == 0) and (prv_selection != 0)) {
MP3player.stopTrack();
prv_selection = selection;
}
else if (selection != prv_selection) {
MP3player.playTrack(selection);
prv_selection = selection;
}
// do other stuff and then loop back around.
}






