Hi,
Im working on a project where i will activate a sound via a touch sensor. As one of the first steps I want to get the functions right. I have gotten the sensor to work but not the mp3 player.
I’m using a MP3 Player Shield v15 and an Arduino Uno.
I tried the test program “file player” and that one worked just fine.
Now a want to activate a sound through a button and i just can’t get any life in my system. I get a note in the serial monitor, nr 1 but no sound is coming out of the speakers… I have tried to get a solutions form google and tutorials but I just cant get what I’m doing wrong.
I would really appreciate any help
Cheers,
//Kåre
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
#include <Bounce2.h>
SdFat sd;
SFEMP3Shield MP3player;
const int buttonPin = 0;
const uint8_t volume = 0; // MP3 Player volume 0=max, 255=lowest (off)
const uint16_t monoMode = 1; // Mono setting 0=off, 3=max
int buttonState = 0;
//------------------------------------------------------------------------------
void setup() {
Serial.begin(115200);
if(!sd.begin(9, SPI_HALF_SPEED)) sd.initErrorHalt();
if (!sd.chdir(“/”)) sd.errorHalt(“sd.chdir”);
MP3player.begin();
}
//------------------------------------------------------------------------------
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
Serial.println(“1”);
MP3player.stopTrack();
MP3player.playTrack(1);
}
}