Hi I have a problem with my code because in my previous project my arduino mega could make a sound but after I tried again in the near future it turned out that the sound could not come out. but when I used the default arduino example program the idea for the simple tone turned out to work. does anyone have a solution? Note: "The Code Work Properly On UNO"
#include "SD.h"
#define SD_ChipSelectPin 53
#include "TMRpcm.h"
#include "SPI.h"
TMRpcm tmrpcm;
void setup(void) {
tmrpcm.speakerPin = 8;
Serial.begin(9600);
if (!SD.begin(SD_ChipSelectPin)) {
Serial.println("SD fail");
return;
}
tmrpcm.setVolume(5);
Serial.println("Play Music");
tmrpcm.play("dona.wav");
Serial.println("Loop Music");
}
// We'll send debugging information via the Serial monitor
void loop(void) {
}
i change it because i follow the guide from example code from arduino ide to play simple tone. and it works! but after i tried it on this code. nothing happens