#include #include #include #include #include AudioPlaySdWav playWav1; AudioOutputUSB audioOutput; // must set Tools > USB Type to Audio AudioOutputAnalog dac; AudioConnection patchCord1(playWav1, 0, audioOutput, 0); AudioConnection patchCord2(playWav1, 1, audioOutput, 1); AudioConnection patchCord3(playWav1, 0, dac, 0); // Use these with the audio adaptor board #define SDCARD_CS_PIN 10 #define SDCARD_MOSI_PIN 7 #define SDCARD_SCK_PIN 14 void setup() { Serial.begin(9600); // Audio connections require memory to work. For more // detailed information, see the MemoryAndCpuUsage example AudioMemory(20); SPI.setMOSI(SDCARD_MOSI_PIN); SPI.setSCK(SDCARD_SCK_PIN); if (!(SD.begin(SDCARD_CS_PIN))) { // stop here, but print a message repetitively while (1) { Serial.println("Unable to access the SD card"); delay(500); } } } void playFile(const char *filename) { playWav1.play(filename); // A brief delay for the library read WAV info delay(5); // Simply wait for the file to finish playing. while (playWav1.isPlaying()) { } } void loop() { playFile("SDTEST1.WAV"); // filenames are always uppercase 8.3 format delay(500); playFile("SDTEST2.WAV"); delay(500); playFile("SDTEST3.WAV"); delay(500); playFile("SDTEST4.WAV"); delay(1500); }