Home Forums Sparkfun MP3 Shield Library Support Forum SFEMP3Sheild not importing

This topic contains 1 reply, has 2 voices, and was last updated by  Michael P. Flaga 7 years, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3162

    Anonymous

    This is the demo sketch that I am trying to run. It will compile but it appears that the SFEMP3Shield library is not importing correctly. When I opened the serial port, the error that it gives me is that sd.begin is not being defined and the MP3player.begin is not defined either.

     

    #include <SPI.h>

    #include <SdFat.h>

    #include <SdFatUtil.h>

    #include <SFEMP3Shield.h>

     

    SdFat sd;

    SFEMP3Shield MP3player;

     

    void setup() {

     

    Serial.begin(9600);

     

    //start the shield

    sd.begin(SD_SEL, SPI_HALF_SPEED);

    MP3player.begin();

     

    //start playing track 1

    MP3player.playTrack(1);

    }

     

    //do something else now

    void loop() {

     

    Serial.println(“I’m bored!”);

    delay(2000);

     

    }

    #3163

    Your description of the symptom at first is a bit confusing.

    The orange and black, sounded you thought they were errors. But really they are just syntax coloring of the Arduino IDE. There are keyword files with special words that are colored. Where the SPI is one, but the others are not. It is only a convenience.

    Where I bet the problem you are seeing in the Monitor is as follows:

    If you get this error, you likely do not have a sd.begin in the main sketch, See Trouble Shooting Guide!
    http://mpflaga.github.com/Sparkfun-MP3-Player-Shield-Arduino-Library/#Troubleshooting

    If so, I am fairly certain you are seeing a secondary symptom. To the failure of sd.begin.

    Note you have replaced

    if(!sd.begin(9, SPI_HALF_SPEED)) sd.initErrorHalt();

    with

    sd.begin(SD_SEL, SPI_HALF_SPEED);

    removing the initial detection of SdCard failure and then falling through to a detection for a different problem, when the SdCard is not properly started.

    if you replace the one line as mentioned, I suspect you will see the following:

    Can't access SD card. Do not reformat.
    No card, wrong chip select pin, or SPI problem?
    SD errorCode: 0X1,0X0

    Which is self explanatory. See other questions in forum about failed SdCard causes.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.