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?

Nick Gammon
38.9k13 gold badges69 silver badges125 bronze badges
asked Jul 23, 2015 at 20:03

1 Answer 1

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.

answered Jul 23, 2015 at 21:10

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.