SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By smity81435
#199330
Hello Everyone!

We are building an Evil Robotic Nun for a class in the BTU Lab at CU Boulder, and we have ran into a very interesting glitch.

Basically, we have an mp3 shield and a strip of Neopixels hooked up to an Arduino Uno, and we need the board to play mp3's.
Sounds easy, right?
Here is where it went funky:
We uploaded the code to the Arduino, and it worked the first time. We switched to 9V DC wall power supply and it worked. We restarted the whole thing and we got this error code:

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- ... leshooting

The weird part is that we already have "sd.begin" in our startup.
Then it got really strange...
We unplugged the wall power supply and uploaded the code again, and it worked. We made some tweaks to the code, and it gave the same error message. Basically, we discovered that, in order to get the board to function, we must unplug its power supply, plug into USB, upload code. If we try any other sequence than that, we get the error mentioned above.
We are using the latest versions of SFEMP3Shield.h and SdFat.h.


Here is the code we are writing to the board:
Code: Select all
#include <SdFatConfig.h>
#include <FreeStack.h>
#include <MinimumSerial.h>
#include <SdFat.h>
#include <BlockDriver.h>
#include <SysCall.h>
#include <SPI.h>
#include <SFEMP3Shield.h>
#include <Adafruit_NeoPixel.h> 

SdFat sd;
SFEMP3Shield player;



int incomingByte = 0;
unsigned long playtime;

#define PIN            5
#define NUMPIXELS      31
int rando;

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  
  pinMode(5, OUTPUT);
  //intialize serial comms
  Serial.begin(9600); //comm rate
  pixels.begin(); // This initializes the NeoPixel library.
  sd.begin(SD_SEL, SPI_FULL_SPEED);
  player.begin();
  player.playTrack(1);
}

void loop() {
  playtime = millis();
  Serial.println(playtime);
  if(playtime >= 30000){
      player.stopTrack();
    }
  //-------------SERIAL COMM-----------------------
   /* if (Serial.available() > 0) {
    // read the incoming byte:
    incomingByte = Serial.read();
    // say what you got:
    Serial.print("I received: ");
    Serial.println(incomingByte, DEC);
  }*/
  
  
  for(int i=0; i<NUMPIXELS; i++){
  pixels.setPixelColor(i, pixels.Color(100,10,10));
  pixels.show();
  }
  delay (random(0, 5000));
  for(int i=0; i<NUMPIXELS; i++){
  pixels.setPixelColor(i, pixels.Color(150,150,150));
  pixels.show();
  //4 thunder tracks
  
  }
  delay(10);
   for(int i=0; i<NUMPIXELS; i++){
  pixels.setPixelColor(i, pixels.Color(100,10,10));
  pixels.show();
  }
  delay (random(0, 5000));

  

}
In order to get our Evil Nun to scare the bageebies out of everyone, we really need to get this working... and FAST.

Anyone have ideas to make it work?
By Valen
#199385
I would look into the code of that library and see what are the conditions for that message to appear. Then see how this relates to you using a 9 volt supply. As that seems to be the difference in regards to conditions.

Technically speaking you are using a different function, a overloaded function with additional parameters. No doubt required to define different from standard pin numbers. I don't know why that would be a problem as compared to the generic sd.begin function. But you got yourself a weird one so best leave common sense assumptions out of the window. Trace back in the code to where this occurs and investigate why it trips.