Ipod Project help learning to read datasheet/question

I never had the luxury of having an ipod player growing up. In fact, I've never owned one at all. But now, i've managed to get my hands on arduino technology. I'm going to make my first MP3 player using a Mega , and a WTV020sd-16p chip if that isn't something to proud of I don't know what is. I've watched Many tutorials but so far all that i've seen play the tracks in order, they don't have a way to vary depending on if a Boolean is high or not. I need to know if it's possible to have the file that plays vary depending on if a boolean is high, rather than only play in order.

I also need to know if this hook up will do the trick for the communication to the WTV020sd-16p chip for the objective that I am trying to achieve.

WTV020sd-16p pin 1 to mega pin 50
WTV020sd-16p pin 4 to black speaker wire
WTV020sd-16p pin 5 to red speaker wire
WTV020sd-16p pin 7 to mega pin 48
WTV020sd-16p pin 8 to mega grw (left of 52)
WTV020sd-16p pin 10 to mega pin 34
WTV020sd-16p pin 15 to mega pin 24
WTV020sd-16p pin 16 to mega 3.3V

I posted the code outline that I am considering using below.

int button1 = 0;
int button2 = 1;
int button3 = 2; 

int led1 = 3;
int led2 = 4;
int led3 = 5;

void setup() {
  // declare the LED pins as outputs
  pinMode(led1, OUTPUT);
  pinMode(led2, OUTPUT);
  pinMode(led3, OUTPUT);


  // declare the switch pin as an input
  pinMode(button1, INPUT);
  pinMode(button2, INPUT);
  pinMode(button3, INPUT);
  
    // declare the booleans needed
    boolean sound1 = 0;
    boolean sound2 = 0;
    boolean sound3 = 0;
}

void loop() {


  if (button1 == HIGH && sound2 == LOW && sound3 == LOW) {
    sound1 = HIGH;
  }

  if (button2 == HIGH && sound1 == LOW && sound3 == LOW) {
    sound2 = HIGH;
  }
  if (button3 == HIGH && sound1 == LOW && sound2 == LOW) { 
    sound3 = HIGH;}
    
    if (sound1 == HIGH){
      digitalWrite(led1,HIGH);
      // play audio file 1 until file ends, then write sound1 to low
    }else{digitalWrite(led1,LOW);}
    
    if (sound2 == HIGH) {
      digitalWrite(led2,HIGH);
// play audio file 1 until file ends, then write sound1 to low
    }else{digitalWrite(led2,LOW);}
    
  if (sound3 == HIGH) {
    digitalWrite(led3,HIGH);
    // play audio file 1 until file ends, then write sound1 to low
  }else{digitalWrite(led3,LOW);}
}

Any thoughts?

If I understand the datasheet (i'm not extremely confident in my ability to read datasheets by the way, but am trying to learn) this chip is not designed to communicate via wire which would allow it to select the track. To my understanding, forward and back is the only way this chip can work... or would pin 10 allow the functionality I want to accomplish? If not, is there a module out there that can do this?

but so far all that i've seen play the tracks in order, they don't have a way to vary depending on if a Boolean is high or not. I need to know if it's possible to have the file that plays vary depending on if a boolean is high, rather than only play in order.

On the top of page 11 of the datasheet there is a table that shows how to name your files, and then how to address them with a serial data-stream.

There is an [u]SPI Library[/u] for the Arduino that should allow you to address (read) the file matching the name (number) you send-in.

This kind of serial communication can be tricky to program and debug, since you can't "see" what data is being sent or received. If it doesn't work, you wont know if the connections are wrong, if the software (sketch) is bad, or if there's something wrong on the receiver side, such as an invalid file or invalid file name.

Since you'd be using general purpose I/O pins, it doesn't matter what Arduino I/O pins you use, as long as they "match" your sketch and audio module on the other end. If you are copying an example project, stick with the same connections so you don't have to change the code.

That module isn't very "friendly" since you have to follow their file-name protocol instead of using "normal" WAV file names.

If you are making an actual music player, of course you'll need an LCD display so you can see what song you are selecting.

On the top of page 11 of the datasheet there is a table that shows how to name your files, and then how to address them with a serial data-stream.

I can't tell you how many times i've asked for references for materials that would be ideal for a beginner to learn binary coding (which triggers data uses) , or how to read datasheets. I wish there was a library example that somewhat demonstrated how to do it.

That module isn't very "friendly" since you have to follow their file-name protocol instead of using "normal" WAV file names.

Can you recommend a more friendly module that has a decent library that would be ideal for a beginner? - preferably one that can upload new song files without removing the sd card from the module if possible.

If you are making an actual music player, of course you'll need an LCD display so you can see what song you are selecting.

I don't want to have to select the files manually like that though. I want the files to be activated by Booleans. Imagine programing something so that the outcome is certain led's lighting up. Any beginner can figure out how to use booleans like this. Same concept but I want the led's to be music files.

I'm going to continue looking into understanding this datasheet, and i'll look into the library you referenced tomorrow. Is there a way to make it so when song has ended the module will know and turn the boolean LOW by the way? I'm sorry I don't know more about how to understand a datasheet. Learning how to is a priority of mine right now.

I have a quick question. I want to take out the next button and replace its function by using pin 6. There are two problems though that I don't know how to address.

First the button setup now when pressed allows the current to go to ground. This is the first time i've seen such a switch, all the ones i've used in the past are designed so when button is pressed it allows current to go arduino.

The second problem is the chip uses 3.3V instead of the 5V arduino supplies.

Can anyone give me a hint on how to rig it so pin 6 on arduino is able to be used instead of pressing the button? Should I try to rig it so that pin 6 is normally high and convert the 5V to 3.3 volts so that it tricks the P02 on the chip (green wire) in a way so that when pin 6 goes low it thinks the button is pressed?