I've tried using Serial.write (0x01) at 9600 baud with no luck. I'm only trying to get the first track to play at this point. I think I am just not sending Hex commands correctly. I posted this originally in Programming , but thought I'd get a better response here, I'm hoping someone else has used this module.
Here's my original code:
#include <SoftwareSerial.h>
SoftwareSerial mp3(4,3); //RX, TX
void setup() {
// initialize the serial communication:
Serial.begin(9600); //Set to 9600 bps
mp3.begin(9600); //Set mp3 serial to 9600 bps
delay(2000);
}
void loop()
{
mp3.write(0x01); // Play 1st file
delay(5000);
}
I've also tried using both Serial.write and mp3.write, Serial.print, mp3.print both with (0x01) and (0x01,HEX) and all combinations. I have gotten the songs to play by grounding k1-k8, so I know my naming conventions are correct and that the module works, I just cannot control it with the arduino.
I've also tried 2 different arduino's in case it was on that end. Any ideas? I really appreciate everyone's help. Thanks.
Hi, I too just received this card and have been trying to get it to work. I'm a newbie to all this, but I eventually got it to play files randomly over serial control. One thing that made all the difference, was resetting the card by grounding the RST pad for a second, then removing and reinstalling power.
and have:
Arduino pin 1--> MDFly RXD
Arduino pin 2--> MDFly BUSY
Power and Speaker as expected
The Sketch I cobbled together is attached. I'm still working through accessing specific files directly, but that was before I added the busy loop. Again, I apologize that while this specific Sketch works for me, I'm still learning and not altogether savvy about this.
EDIT: Learned how to add code inline
const int busyPin = 2; // the number of the Busy pin
void setup(){
Serial.begin(9600,SERIAL_8N1);
Serial.write(0xFA); // Reset board
delay(2000); // wait for a 2 seconds
pinMode(busyPin, INPUT);
}
void loop(){
if (digitalRead(busyPin) ==HIGH) {
//device busy
}
else {
Serial.write(0xEB);
delay(5000); // wait for a 5 seconds
}
}