I have tested the SimpleAudioPlayer example.


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 

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


Does anyone have any idea on how to resolve this?

1 Answer 1


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 and acknowledge you have read our privacy policy.

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