Hi,
First off, I'm a noob so please bear with me..
I'm having an issue which is driving me nuts, it must be a "me" issue as I cannot find any instances of anyone else with the same issue.
The problem I'm having is when I send commands to the player it can return a track I was not expecting.
For example, in my head, sending this command should play track 11:
sendCommand(CMD_PLAY_W_VOL, 0X1E11);
but it plays track 17 on the SD card... I have attached the code with the example.
I have numbered the tracks on the card as per the players manual (please see attached screenshot) and I have used a MP3 tag manager to remove all mp3 tags just in case.
Please can someone point out the bleeding obvious mistake I'm making? I can't see the wood for the trees on this one.. :o
Thanks in advance.
Paul
Setup
Arduino Mega with Catalex MP3 module on HW Serial 3
// MP3 SETUP_____________________________________________________
#define mp3 Serial3
static int8_t Send_buf[8] = {0} ;
#define CMD_SEL_DEV 0X09
#define DEV_TF 0X02
#define CMD_PLAY_W_VOL 0X22
#define CMD_PLAY_W_INDEX 0X03
#define CMD_PLAY 0X0D
#define CMD_PAUSE 0X0E
#define CMD_PREVIOUS 0X02
#define CMD_NEXT 0X01
void setup() {
//-------(Initialse Serial)----
Serial.begin(9600);
mp3.begin(9600);
delay(500);
sendCommand(CMD_SEL_DEV, DEV_TF);
}
void loop() {
sendCommand(CMD_PLAY_W_VOL, 0X1E11);
delay(5000);
}
////////////////////////////////////MP3 Commands/////////////////////////////////////////////////////
void sendCommand(int8_t command, int16_t dat)
{
delay(20);
Send_buf[0] = 0x7e; //starting byte
Send_buf[1] = 0xff; //version
Send_buf[2] = 0x06; //the number of bytes of the command without starting byte and ending byte
Send_buf[3] = command; //
Send_buf[4] = 0x00;//0x00 = no feedback, 0x01 = feedback
Send_buf[5] = (int8_t)(dat >> 8);//datah
Send_buf[6] = (int8_t)(dat); //datal
Send_buf[7] = 0xef; //ending byte
for(uint8_t i=0; i<8; i++)//
{
mp3.write(Send_buf[i]) ;
}
}
