Help with mp3 player

I am a student trying to make a soundboard-esque program using an mp3 player, how do I make it play a different sound for a different button?

// SoftwareSerial - Version: Latest
#include <SoftwareSerial.h>

#define ARDUINO_RX 12 //TX of the Serial MP3 Player module
#define ARDUINO_TX 13 //RX of the Serial MP3 Player module

SoftwareSerial mySerial(ARDUINO_RX, ARDUINO_TX); //initialize software serial object

//create arrays to store commands/data for each MP3 function
byte selectSD[8] = { 0x7E, 0xFF, 0x06, 0x09, 0x00, 0x00, 0x02, 0xEF };
byte setVol[8] = { 0x7E, 0xFF, 0x06, 0x06, 0x00, 0x00, 0x1E, 0xEF };
byte playTrack[8] = { 0x7E, 0xFF, 0x06, 0x0F, 0x00, 0x01, 1, 0xEF };

void setup() {
mySerial.begin(9600);
//Serial.begin(9600); //for debugging, output array values to Serial monitor

for (uint8_t i = 0; i < 8; i++) {
mySerial.write(selectSD[i]); //select SD card storage
//Serial.println(selectSD[i]); //for debugging, output array values to Serial monitor
}

for (uint8_t i = 0; i < 8; i++) {
mySerial.write(setVol[i]); //set volume ($1E (decimal 30) = MAX)
}

for (uint8_t i = 0; i < 8; i++) { //play track 001 in folder 01/
mySerial.write(playTrack[i]);
}
}

void loop() {
}
the button will be done using a server.on, I have gotten the button to work but the code does not work

Which exact MP3 player?

Which Arduino board?

I see no code for a button. How will the be button wired?

Please post a schematic. Hand drawn, photographed and posted is fine. Include all pin names/numbers, components, their part numbers and/or values and power supplies.

Please read the forum guidelines to see how to properly post code and some information on making a good post.

Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in a code block.

Please go back and fix your original post.


the

arduino board is ESP8266
Mp3 player is just called Serial mp3 player v1.0
pins being used for the mp3 player are d6,d7,g,vv
power supply is 7.4v

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.