Using an SD card for both an audio stream and data storage. #1851
-
I am building a DIY alarm clock based around an esp32. It uses audio-tools to play songs from a micro SD card for the alarm. I am working on saving the alarm clock settings such as volume, alarm time, etc. on the SD card in a txt file. I ran into difficulties when trying to use the audio stream as well as reading and writing to the SD card. When I try to read from the SD card without stoping the audio stream it simply halts the program when I try to open the file. When I first end both the source and the player doesn't halt the program, but the file does not open. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
Just stick to one library and don't mix SD and SDFAT! |
Beta Was this translation helpful? Give feedback.
-
Thank you for your quick response. When I use only the SDfat library the same thing happens. Check the example program I attached. I need to store the settings on the SD card so that the user can edit the wifi ssid and password and others. |
Beta Was this translation helpful? Give feedback.
-
I think it would be simpler to use the SD library and just do the initialization via AudioSourceSD |
Beta Was this translation helpful? Give feedback.
-
I managed to get it working (with the help of ChatGPT). If there is anything that could be improved feedback would be great. Again here is the link:https://app.arduino.cc/sketches/474cfb77-3d6b-4b59-8d08-7d071bae2804?view-mode=preview |
Beta Was this translation helpful? Give feedback.
AudioSourceSDFAT is initializing the sdfat library, so you might need to extend it a bit to avoid any conflicts: e.g. a get method that provides the AudioFs