Playing random file from Wave Shield

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
sawmac
 
Posts: 28
Joined: Mon Dec 08, 2008 1:32 pm

Playing random file from Wave Shield

Post by sawmac »

Someone on the forum wanted to know how to play a random file on the Wave Shield. Here's my solution. First, you need to make sure you have the helpful MediaPlayer class: http://www.arduino.cc/cgi-bin/yabb2/YaB ... 33246215#2. This really simplifies using the shield, now for the code:

int numSongs=mediaPlayer.exploreSDcard();
randNumber = random(numSongs);
playComplete(randNumber);

You may also want to use randomSeed() function in the setup() function as described here: http://arduino.cc/en/Reference/Random

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”