Skip to content

Instantly share code, notes, and snippets.

Last active Feb 10, 2016
What would you like to do?
Simple example of playing a sequence of tracks.
// libraries
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
// initialize MP3 card
SdFat sd;
SFEMP3Shield MP3player;
byte result; // variable for mp3 player shield, can be used to debug
// setup
void setup() {
if(!sd.begin(9, SPI_HALF_SPEED)) sd.initErrorHalt();
if (!sd.chdir("/")) sd.errorHalt("sd.chdir");
// loop
void loop() {
for (int i=0; i <= 255; i++) {
if(!MP3player.playTrack(i)) { // if it returns an error move on to next track.
while (MP3player.isPlaying());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment