I am new to arduino (UNO Atmega328p) and I know I have jumped in the deep end as far as understanding code goes.
void setup()
{
// If your SD card CS-Pin is not at Pin 4, enable and adapt the following line:
// SdPlay.setSDCSPin(10);
// Init SdPlay and set audio mode and activate autoworker
if (!SdPlay.init(SSDA_MODE_FULLRATE | SSDA_MODE_MONO | SSDA_MODE_AUTOWORKER)) {
while(1); // Error while initialization of SD card -> stop.
}
// Select file to play
if(!SdPlay.setFile("hornshep.AFM")) {
while(1); // Error file not found -> stop.
}
}
void loop(void) {
// Start playback
SdPlay.play();
// Optional: Wait until playback is finished
while(!SdPlay.isStopped()) {
; // no SdPlay.worker() required anymore :-)
}
}
I want to change this code to play another file after a delay of say 10 secs, and then another after that.
I tried copying the code and pasting it on the end with different file names but that didn't work. Sorry I didn't keep that to show.
I was successful with Simple Sd Audio sketch - bare minimum. I edited the file with audacity to mono and raw - .AFM. I converted it with "Full rate @ 8Mhz_mono.bat and then played the sound file reasonable quality. I used a micro sd card in SDsheild and connected it to the microcontroller and then ot TBA820M kit and 8 ohm speaker.
On my model railway I want sound effects, not continuous but varied I want to use sound as a background, train and animal sounds etc.