I'm trying to play audio through a speaker (8 ohm 0.25w) via an amplification module (lm386). The sounds come from a 32gb sd card in a micro sd adapter connected to the arduino. Each file is an 8 bit wav 88200 mhz. Every time I run the code I wrote it makes a "cilck" noise, then sort of hums/buzzes, not playing the required sounds.
#include <SPI.h> // include Arduino SPI library
#include <SD.h> // include Arduino SD library
#include "TMRpcm.h" // include TMRpcm library
TMRpcm audio;
void setup(void) {
Serial.begin(9600);
Serial.print("Initializing SD card...");
if (!SD.begin(10)) {
Serial.println("failed!");
while(true); // stay here.
}
Serial.println("OK!");
audio.speakerPin = 3;
audio.setVolume(7);
audio.play("1.wav");
}
// main loop
void loop() {
}
Here's a wiring diagram
