When i try to play music in Serial UART mp3 player module, i just hear the clicking sound from the speaker and i think it is because my sd card, that formatted to fat32 with 3.8 gb storage.
anyone know how to fix this clicking sound?
#include <SoftwareSerial.h>
#define ARDUINO_RX 2
#define ARDUINO_TX 3
SoftwareSerial myMP3(ARDUINO_RX,ARDUINO_TX);
byte sendBuffer[6];
void selectTFCard(){
sendBuffer[0] = 0x7E;
sendBuffer[1] = 0x03;
sendBuffer[2] = 0x35;
sendBuffer[3] = 0x01;
sendBuffer[4] = 0xEF;
sendUARTCommand();
}
void playSound(byte songNumber){
sendBuffer[0] = 0x7E;
sendBuffer[1] = 0x04;
sendBuffer[2] = 0x41;
sendBuffer[3] = 0x00;
sendBuffer[4] = songNumber;
sendBuffer[5] = 0xEF;
sendUARTCommand();
}
void stopSound(){
sendBuffer[0] = 0x7E;
sendBuffer[1] = 0x02;
sendBuffer[2] = 0x0E;
sendBuffer[3] = 0xEF;
sendUARTCommand();
}
void setplayVolume(byte volum){
sendBuffer[0] = 0x7E;
sendBuffer[1] = 0x03;
sendBuffer[2] = 0x31;
sendBuffer[3] = volum;
sendBuffer[4] = 0xEF;
sendUARTCommand();
}
void sendUARTCommand(){
int q;
for(q=0;q<sendBuffer[1] + 2;q++){
myMP3.write(sendBuffer[q]);
}
Serial.println("command Sent");
for(q=0;q<sendBuffer[1] + 2;q++){
Serial.println(sendBuffer[q],HEX);
}
delay(25);
}
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("UARTserialV2");
myMP3.begin(9600);
delay(500);
selectTFCard();
setplayVolume(30);
}
void loop() {
// put your main code here, to run repeatedly:
int q;
for(q=0;q<4;q++){
playSound(q);
delay(4000);
stopSound();
}/*
for(q=0;q<30;q++){
setplayVolume(q);
playSound(1);
delay(2000);
stopSound();
}*/
}