Go Down

Topic: How to get Filename by file index?? (Read 1 time) previous topic - next topic


hi there

Source:: \arduino-1.0\libraries\MusicShieldNewSDLib\examples\MusicPlayRandomly\MusicPlayRandomly.ino
#include <Arduino.h>
#include <avr/io.h>
#include "config.h"
#include "player.h"
#include "vs10xx.h"

#include <Fat16.h>
#include <Fat16Util.h>
#include "newSDLib.h"

void setup()





 if (!initialSDCard())

 RED_LED_ON();//light red LED

void loop()
 file.traverseDir("MP3");//find all the .mp3 files in the root directory.
 while(1)playFile();    //shuffle your music you find in the root directory of SD card.

Is there anyway to print out the full file name which is playing now??
Many thanks


I'm not even sure how that code you have is supposed to actually work.

If I was trying to solve your problem,  (a) I would get an actual list of filenames,   
(b) select one randomly myself,
(c) print the file name,   
(d) play the music,   

and then repeat from (b).

What is  file.traverseDir()  actually doing,   and where do the results of this function go ?
If the answer to this is,   it is a list stored in the "file" object somewhere,   then why isn't
the following call not  "file.playFile()"  if it is expected to get some information from this object ?

Go Up