Hi:
I am trying to use the command gettracklength() to retrieve the length of an mp3 track, but not having much luck. Probably I am not using the correct syntax.
I am posting the code below. Note that I am using the rmp3 shield with an Arduino Mega. The target file is in the root directory of the SD card.
Any help will be gtreatly appreciated.
Robbie.
#include <RogueMP3.h>
#include <RogueSD.h>
RogueMP3 rmp3(Serial1);
RogueSD filecommands(Serial1);
void setup()
{
Serial.begin(9600);
Serial1.begin(9600);
rmp3.sync();
rmp3.stop();
const char *path = "";
const char *filename = "/mysong.mp3";
int16_t lengthOfTrack;
lengthOfTrack = rmp3.gettracklength(filename);
delay(200);
Serial.println(lengthOfTrack);
Serial.println(rmp3.LastErrorCode, HEX);
rmp3.playfile(filename);
}
void loop()
{
}