-1

I have tested the SimpleAudioPlayer example.

https://www.arduino.cc/en/Tutorial/SimpleAudioPlayer

This works fine, but when I add a sleep(1000) at the end of the loop() function, the music sounds dismembered (second run).

void loop()
{
    // ... source from the example 

    myFile.close();
    Serial.println("End of file. Thank you for listening!");

    sleep(1000);
}

Does anyone have any idea on how to resolve this?

0

sleep() is something different. You are probably want to use delay(1000) instead.

sleep() comes from libsam and is not very well documented for use within the Arduino environment. There is probably a conflicting timer or interrupt between sleep() and the Audio.h library. So sticking with delay() is probably your best option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.