First I am not sure which Arduino GPIOs are used by the shield. At the moment I am using 2, 8 and 9 for my needs and this works. I have tried 10, but this is accessed by some routine while setup, I suspect the SD card functions.
It would be helpful to have this documented more detailed in the manual.
And my second problem are the onboard GPIOs. If I start the player in interrupt mode and make read access to one of the GPIOs while loop() then the player stops after some seconds. Without access on the GPIOs the player works as expected. I have condensed the code to the relevant parts, here is the code that does not work for me, if I comment out the musicPlayer.GPIO_digitalRead(1) line, then it works. Did I miss something?
Code: Select all
// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
// These are the pins used for the music maker shield
#define SHIELD_RESET -1 // VS1053 reset pin (unused!)
#define SHIELD_CS 7 // VS1053 chip select pin (output)
#define SHIELD_DCS 6 // VS1053 Data/command select pin (output)
// These are common pins between breakout and shield
#define CARDCS 4 // Card chip select pin
#define DREQ 3 // VS1053 Data request, ideally an Interrupt pin
Adafruit_VS1053_FilePlayer musicPlayer =
// create shield object
Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
int x;
char CurrentFileName[]="trac0004.mp3";
void setup()
{
Serial.begin(9600);
// initialise the music player
if (! musicPlayer.begin())
{ // initialise the music player
Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
while (1);
}
if (!SD.begin(CARDCS))
{
Serial.println(F("SD-Karte defekt oder fehlt."));
}
musicPlayer.setVolume(0,0);
if (! musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT))
Serial.println(F("DREQ pin is not an interrupt pin"));
}
void loop()
{
if(!musicPlayer.playingMusic)
{
musicPlayer.startPlayingFile(CurrentFileName);
}
x=musicPlayer.GPIO_digitalRead(1);
delay(10);
}