VS1002 problems again, only with the program this time
science_geek
Posts: 247
ok, so i have the vs1002 up and working just like its supposed to...sorta. i can make it play one song, but when that song is done i cant get it to play a different song below is my code, i think the problem lies with the dataout method but i just cant figure it out for sure, if anyone has one of these working with multiple songs please help.
PUB Start | Bytes, Read, Count, Poss MP3.start (11,8,10,9,12) ' Start mp3 object debug.start(31, 30, 0, 115200) dira[noparse][[/noparse]13]~ dira[noparse][[/noparse]14]~~ sdfat.mount(16) sdfat.popen(String("wordup.mp3"), "r") hello := 1 outa[noparse][[/noparse]14] := 1 mp3.SetBassBoost(180) mp3.SetBassBoost(180) MP3.WriteReg(3,33000) MP3.SetVolume(220,0) ' <<-- Change mp3 file name here. ' <<-- Set clock devider. This is verry improtant, if you do not it will play very slowly ' Volume defalts to zero on startup, so it must be set. DataOut PUB DataOut | Bytes, Read, Count, Poss repeat if ina[noparse][[/noparse]13] == 1 Poss += sdfat.pread(@SDBuffer,32) Count~ if Bytes < 32 repeat Bytes MP3.WriteDataByte(SDBuffer[noparse][[/noparse]Read++]) sdfat.pclose quit MP3.WriteDataBuffer(@SDBuffer) debug.str(string("next Songssssssssss")) sdfat.popen(String("crusade0.mp3"), "r") mp3.SetBassBoost(180) MP3.WriteReg(3,33000) MP3.SetVolume(220,0) repeat if ina[noparse][[/noparse]13] == 1 Poss += sdfat.pread(@SDBuffer,32) Count~ if Bytes < 32 repeat Bytes MP3.WriteDataByte(SDBuffer[noparse][[/noparse]Read++]) quit MP3.WriteDataBuffer(@SDBuffer)
Comments
Just a guess.