SFEMP3Shield MP3player // Create Mp3 library object SdFat sd // Create object to handle SD functions #include // SDFat Util Library include // Mp3 Shield Library */ include // SPI library include // SDFat Library Porter and Michael Flaga, again, for this amazing library! Much of this code was grabbed from the FilePlayer example Also, because pins 0 and 1 are used as triggers (MIDI-IN and GPIO1) can be cut open and used as additional If you need more triggers, the shield's jumpers on pins 3 and 4 When a new pin is triggered, any track currently playing willĪ5 is setup to globally STOP playing a track when triggered. Their respective track will start playing. Whenever any of those pins are shorted to ground, Pins 0, 1, 5, 10, A0, A1, A2, A3, and A4 are setup to trigger tracks This is an example MP3 trigger sketch for the SparkFun MP3 Shield. I go to my libraries folder and it is there along with the other files called for in the sketch, although it does not appear in the library manager. Says "SFEMP3Shield.h: No such file or directory". I tried using this test Arduino program and it will not compile. I was unable to find much reference anywhere to anyone having an issue such as this? I was also unable to find many references of people powering this shield with a wall wort as opposed to USB from a computer? Hope this helps someone! Now, it does exactly what I needed it to do. A 3 second delay worked about 3 or 4 out of 5 times. By putting a 4 second delay at the beginning of setup, another 4 second delay after the sd card reader initialization, and a final 4 second delay after the mp3 initialization before the loop begins, it worked perfectly! After playing with the delay timing for a while, I found that a 2 second delay would work 1 out of 5 times. After playing around with a few delays throughout the setup procedure, I finally got it. After staring at the sketch, I thought that maybe the Mp3 file player and the MicroSD card reader did not have enough time to initialize, and therefore, caused an error. After a couple of days of pulling my hair out trying to figure out why everything worked seamlessly when plugged into the computer USB, but would only work maybe 1 out of 10 times when plugged straight into the wall, it dawned on me. Only when I unplugged from the USB of my computer and tried to using the 9V/650mA wall wart did I start having problems. Made a few mods to the MP3 trigger sketch to fit my needs. Spent 10 minutes setting up the shield on a redboard. Update: I just updated both the SD library and the shield library and that appears to have addressed the initialization issues I have been occasionally seeing. ![]() Bottom line: if it's gotta work, budget one or two extras to be safe. Some of the noise can be addressed by adding extra Vcc bypass caps. Switching to my good amp & speakers, I finally heard that all of the circuits had some degree of digital noise, although it was not noticeable on computer speakers for the most part. It sounded like a 16mm film projector from the '70s. I got one shield that sounded like it had excessive data req noise in the output, which was the first time I became aware that there was any unusual noise at all. ![]() I'd also like to add that the audio is fairly noisy-sounds like digital noise bleeding into the analog output-so you will want to keep the fidelity of your playback system fairly low. That first shield has since stopped working altogether, so maybe it was defective, I dunno. I had similar initialization problems as Member 873628 with my first shield (worked with USB, failed 50% of the time under external power) but I suspect that it was just a problem with that particular shield because none of the other 8 required any special delays in order for them to initialize properly. Having purchased and built with 9 of these shields (7 from SparkFun, 2 from Mouser), I can confirm that they're very easy to use and inexpensive for what they do.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |