Home › Forums › Sparkfun MP3 Shield Library Support Forum › Adding an LED.. › Reply To: Adding an LED..
hi there-
i’m trying to simplify the code, just to get the getVUmeter reading in the “while” loop….but i’m just getting a bunch of garbled text and then a stream of zeroes. any ideas?
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
SdFat sd;
SFEMP3Shield MP3player;
byte result;
void setup() {
Serial.begin(115200);
result = sd.begin(SD_SEL, SPI_FULL_SPEED);
result = MP3player.begin();
MP3player.setVolume(20, 20);
randomSeed (millis()); // set a more random seed for the random function
Serial.println(“Hello”);
}
void loop() {
MP3player.playTrack(random(5)); // range of tracks to randomly play.
while (MP3player.isPlaying()){
Serial.println(MP3player.getVUmeter());
}
MP3player.stopTrack();// stop track
}