Hello everyone.
I write on the forum (hoping for some kind soul) so as to find an answer.
I've finally finished my sketch for audio playback with Arduino MKR Zero.
Quite working as I want but with the only flaw ....... have output on pin DAC0 / A0 an annoying noise (which by the way is greatly amplified by the amplifier 3W attached to it).
I wanted to know if any of you, has the possibility to explain (and possibly advise) the reason of this pin there is a noise of this type, either with the waiting instruction card and is at the end of the audio playback.
Does anyone know kindly explain and / or give me suggestions to eliminate this problem?
I leave you in the description under the program I compiled and running for audio playback with consent by PULLUP button.
#include <SD.h>
#include <SPI.h>
#include <AudioZero.h>
int buttonPin = 1;
void setup()
{
// debug output a 115200 baud
Serial.begin(115200);
// setup SD card
Serial.print("Inizializzazione SD card...");
if (!SD.begin())
{
Serial.println(" fallita!");
while(true);
}
Serial.println(" successo.");
// 44100kHz stereo => 88200 frequenza di campionamento
AudioZero.begin(2*44100);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop()
{
int count = 0;
int valuno = digitalRead(buttonPin);
if (valuno == LOW)
{
// Apri file wav da SD card
File myFile = SD.open("darth.wav");
if (!myFile)
{
// se il file non si apre, stampare un errore e interrompere
Serial.println("errore nell'apertura di darth.wav");
while (true);
}
Serial.print("In Riproduzione");
// fino a quando il file non è finito
AudioZero.play(myFile);
Serial.println("Fine del file. Grazie per l'ascolto!");
while (true) ;
}
}