I have some experience using the Wav shields but I'm by no means a master coder. I'm trying to figure out some code that on a button press will play one of 80 or so .wav files then stop waiting for the next button press which will then play the next file and so on. Once it reaches file 80 the next button press will bring it back to file 1 and continue as before.
I can't even seem to locate a sketch close enough to alter to meet my needs. Any ideas? Anybody else make something like this?
Point me in the right code direction? Playing consecutive files using one button.
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 10
- Joined: Sun Sep 05, 2010 1:36 pm
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Point me in the right code direction? Playing consecutive files using one button.
Start with the "Digital Audio Player" example here: http://www.ladyada.net/make/waveshield/examples.html
And have it wait for a button press before it plays each file. This would be the place in the code...
And have it wait for a button press before it plays each file. This would be the place in the code...
Code: Select all
// Aha! we found a file that isnt a directory
putstring("Playing "); printName(dirBuf); // print it out
if (!wave.create(file)) { // Figure out, is it a WAV proper?
putstring(" Not a valid WAV"); // ok skip it
} else {
Serial.println(); // Hooray it IS a WAV proper!
wave.play(); // make some noise!
- loki1759
- Posts: 1
- Joined: Tue Jul 10, 2012 12:24 am
Re: Point me in the right code direction? Playing consecutive files using one button.
Sorry to drudge up such an old topic...this is exactly what I'm trying to do. In this case how would I have it wait for a button press before each play?
Thanks for the help!
Thanks for the help!
- adafruit_support_bill
- Posts: 88154
- Joined: Sat Feb 07, 2009 10:11 am
Re: Point me in the right code direction? Playing consecutive files using one button.
On the examples page there are 7 different examples that play tracks in response to a button press:
http://www.ladyada.net/make/waveshield/examples.html
Also, Lady Ada's Arduino Tutorial #5 covers buttons in detail: http://www.ladyada.net/learn/arduino/lesson5.html
http://www.ladyada.net/make/waveshield/examples.html
Also, Lady Ada's Arduino Tutorial #5 covers buttons in detail: http://www.ladyada.net/learn/arduino/lesson5.html
Please be positive and constructive with your questions and comments.