Ok so after a month of working on this I am so close it's painful. I have hooked up the arduino (Elegoo in fact) Uno to an old rotary phone. The micro SD card attached is supposed to play the audio file through the phone which it doesn't.
I have ran prints to make sure it can actually find the file on the card, and that the card is initialising which it is. However, when the file plays, all I get is static.
I am using the TRMpcm library, but just cant get it to play the file (or it is playing but is just inaudible)
I have checked the phone is actually working OK and it is.
Does anyone have any experience with MicroSD cards and playing audio that could help?
FULL CODE attached
THE VIDEO OF THE PROJECT LIKE THIS ONE:
Code where it plays...
// This number plays a recorded message
Serial.println("before if check");
if(strcmp(number, "5213023") == 0){
#ifdef DEBUG
Serial.println (F("Playing Solved Sound"));
#endif
// Now, we set the pin as OUTPUT for the audio signal
pinMode(phonePin, OUTPUT);
Serial.println("PHONE PIN SET TO OUTPUT CHECK");
// Set the TMRPCM library to use the pin for the output
tmrpcm.speakerPin = 9; // Must be 5, 6, 11 or 46 on MEGA, 9 on UNO, NANO etc
Serial.println("SPEAKER PIN 9");
// Play the appropriate sound file
tmrpcm.play("mp3.mp3");
Serial.println("PLAY MUSIC");
// Wait until the reciever is replaced on the handset
// while(!digitalRead(hookPin)){
pinMode(hookPin, INPUT); {
Serial.println("HOOK PIN SET TO INPUT");
delay(10);
Serial.println("DELAY CHECK"); }
}
// If an incorrect number was dialled
else {
Serial.println("BEFORE ELSE CHECK");
Serial.println("Playing Incorrect Number Sound");
// Set the pin as OUTPUT
pinMode(phonePin, OUTPUT);
Serial.println("PHONE PIN SET TO OUTPUT CHECK");
// Set the TMRPCM library to use the pin for output
tmrpcm.speakerPin = 9; // Must be 5, 6, 11 or 46 on MEGA, 9 on UNO, NANO etc
Serial.println("SPEAKER PIN 9");
// Play the appropriate sound file
tmrpcm.play("wrongnumbermonowav");
Serial.println("PLAY WRONG NUMBER MUSIC");
//state = OFF_HOOK;
// Wait until the reciever is replaced on the handset
// while(!digitalRead(hookPin)){
pinMode(hookPin, INPUT); {
Serial.println("HOOK PIN SET TO INPUT");
// Now wait for the audio to play
delay(1500);
Serial.println("DELAY CHECK");
FULL CODE attached
CODE4.txt (8.57 KB)