Logging Data (SD Card) & Play MP3 Music (MicroSD Card) simultaneously

Hey everyone,

I hope I’m posting this in the correct group :slight_smile:

I’m really excited about this project that I’m working on, but I am new to Arduino and I have a few questions. Currently, I am able to run four sensors and record their data to an SD card, via the Data Logging Sheild, on the Arduino Uno. I am also able to play mp3 music out of a separate microSD card on the Music Maker Shield. However, I’m having trouble playing the mp3 music while simultaneously being able to record the sensor data to the SD card. How can I combine both of these features? In other words, how can I play the music in the background? I tried to combine the player_interupts code, from the Adafruit VS1053 Library to my data logging code by putting the readings of the sensors into a while loop, but now both the data isn’t being recorded and the music isn’t playing.

If anyone has any ideas that would be really helpful.
Attached is my code that works with the Data Logger (no music).
The code I will be running is the MasterSensorNoMusic.

Thanks :slight_smile:

MasterSensorNoMusic.zip (10.6 KB)

Currently, I am able to run four sensors

Are you running them into the ground? You don't "run a sensor". You read a sensor. That may require that you do something to make it supply data to be read, such as turning on power to it, or sending a pulse that might be reflected by something in the environment. But, that is not usually described as "running a sensor".

However, I'm having trouble playing the mp3 music while simultaneously being able to record the sensor data to the SD card.

Without describing the "trouble", that is a useless statement.

n other words, how can I play the music in the background?

What "background"? The Arduino has ONE processor and no operating system. The concept of foreground and background processing does not exist.

Depending on which mysterious music shield you have, it may, or may not, have a microprocessor on it that handles all of the work of making noise happen.

If you don't want the music shield to play music, why bother attaching it?