Home › Forums › Sparkfun MP3 Shield Library Support Forum › simple class error
- This topic has 4 replies, 2 voices, and was last updated 11 years, 9 months ago by Anonymous.
-
AuthorPosts
-
February 17, 2013 at 9:35 pm #2148AnonymousInactive
Hi,
I wanted to start by saying thanks for this awesome library. It has made my project so much easier. I have a quick question however. I am trying to have the MP3 shield turn off if a song is not playing with a simple if statement like this
if (MP3player.isPlaying() != TRUE){
MP3player.end();
}
However, I keep getting an error stating “class SFEMP3Shield’ has no member named ‘end'” Now I know the library is loaded as all the other commands work and even the command “end” shows up in orange. Anyone have any ideas on this?
Also is this the best way to conserve battery life? What I have made is not going to be playing an MP3 all that often.
Thanks
February 17, 2013 at 9:59 pm #2149Michael P. FlagaMemberStrange. Please, note in the current example MP3Shield_Library_Demo.ino :
…
} else if(key_command == ‘O’) {
MP3player.end();
Serial.println(F(“VS10xx placed into low power reset mode.”));
…Compiles just fine. Since your reported error did not error on the isPlaying, It sounds like the library you have linked to is prior to 1.01.00, when SFEMP3Shield::end() was added.
The SFEMP3Shield::end() function was created just for this; to save power. There is a low power soft mode, but the data sheet states the most power savings is done by putting the chip into reset. Which is what end() does. And you can come out of reset by re-initializing the VS1053 by calling SFEMP3Shield::vs_init(). No need to re-call SFEMP3Shield::begin() which only deals with the Arduino’s pins.
Hence the MP3Shield_Library_Demo.ino example has
…
} else if(key_command == ‘R’) {
MP3player.stopTrack();
MP3player.vs_init();
Serial.println(F(“Reseting VS10xx chip”));
…February 19, 2013 at 7:24 pm #2150AnonymousInactiveThanks for your help! So you hit the nail on the head with the problem. I started this project last summer and had not realized that the library had updated. I updated the library and I no longer have the error. However, I now have this one.
SFEMP3Shield/SFEMP3Shield.cpp.o: In function `SFEMP3Shield::begin()’:
/Users/sqeekypotato/Documents/Arduino/libraries/SFEMP3Shield/SFEMP3Shield.cpp:99: undefined reference to `sd’
This sketch was working (and is currently running on my Arduino with the old library)
I’ve made sure that I have the most recent SD library in case that was the problem and it didn’t fix it. I also tried compiling sketches that I had installed on my Arduino successfully before updating the library and I am getting the same error. The thought just occurred to me, when I started working on this project, following the instructions on Bill Porter’s website, I changed a setting in a header file (I can’t remember what file or what I did off the top of my head). Is this still required? Would this be screwing it up?
Any suggestions? Thanks again for the help
February 19, 2013 at 11:48 pm #2151Michael P. FlagaMemberPlease look at the Git Hub Project Page’s Trouble Shooting Guide
It explains the problem you are seeing.
Note the following in the examples, as to instanciate the sd prior to its use.
SdFat sd; // newly required in 1.01.00 and higher
February 20, 2013 at 7:41 pm #2152AnonymousInactiveThat fixed it. Thank you, you are awesome.
-
AuthorPosts
- You must be logged in to reply to this topic.