Hey,
I recently purchased an Arduino UNO rev3 along with a player module from DFrobot. I also have other bits and pieces like sensors and buttons for the school project im working on. I understand the basics of programming, however i am not quite sure what to do about using my player module.
Currently i have programmed my board to play the next track on the SD in the player module when u press a button. What i want to do however, is call a filename on the SD and play it.
The player module from DF robots comes with the following commands:
Support Commands
Play music via receiving filename command "filename\r\n" Return "Play ok\r\n" if success. Return "Not found\r\n" if failed to find the file.
Return "over\r\n" if finish playing one song.
Pause Play ":p\r\n" Return "pause\r\n" if success
Continoue Play ":s\r\n" Return "start\r\n" if success
Play next ":n\r\n" Return "next\r\n" if success?Return "false\r\n" if failed
Play previous ":u\r\n" Return "key up\r\n"
Set the volume ":v 255\r\n"?set the volume, from 0 (minimum)-255 (maximum), Return "vol set ok" if success
My current program is:
// Product name: DFRduino Player Module
// # Product SKU :TOY0008
// # Version : 0.1
// # Description:
// # This sample code is for testing DFRduino Player Module
// # Connection:
// # Arduino MP3
// # TX RX
// # RX TX
// # 5V +5V
// # GND GND
// # Support Commands:
// # 1. Pause Play ":p\r\n" Return "pause\r\n" if success
// # 2. Continoue Play ":s\r\n" Return "start\r\n" if success
// # 3. Play next ":n\r\n" Return "next\r\n" if success?Return "false\r\n" if failed
// # 4. Play previous ":u\r\n" Return "key up\r\n"
// # 5. Set the volume ":v 255\r\n"?set the volume, from 0 (minimum)-255 (maximum), Return "vol set ok" if success
int button = 6;//button in digital 3
void setup()
{
pinMode(button, INPUT);
Serial.begin(19200);
delay(2000);//Wait for 2 seconds
Serial.println("\:v 225"); // set the volume, from 0 (minimum)-255 (maximum)
delay(50);
}
void loop()
{
if(digitalRead(button)==LOW)
{
delay(50);
if(digitalRead(button)==LOW)
{
Serial.println("\:n"); // Play next
Serial.println("OK");
}
}
}
So what i want to know is how i go about calling a filename?