Hey guys, I'm working on an voice-controlled robot system with an Arduino Mega and the MOVI shield,
and I'm attempting to get the shield to play mp3 files on request.
I want the code to work so that when the password is received (a simple digital variable), it will randomly select a file from a preset genre. For instance, when I say "Play some indie rock," I want it to randomly select one of several files in that genre to play.
I sense this involves if statements, strings, and some sort of random function but I can't exactly put it all together.
Any ideas on how to tackle this?
Thanks,
Clark Auger
Any ideas on how to tackle this?
Step 1: Post a link to the MOVI shield and any libraries that you are using.
Step 2: Post the code you have so far.
Generating a random number is pretty simple. If the files have numbers in the names, choosing the right name is easy. If not, choosing the nth file is a bit more difficult since you either need to create an array of names and choose the name based on the random position, or you need to get the next file in the directory n-1 times, where n is the random number. Then, you play that file.