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