Wave Shield Programming help...
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 16
- Joined: Fri Nov 18, 2011 2:55 pm
Wave Shield Programming help...
Ok, so I must be doing something wrong, All I want is for the wave shield to read the one audio file on my SD card and play it automatically so that I can make sure all is working correctly, how can I do this. I am using the AF_Wave library, I have the library installed in the arduino libraries folder and am using the PiSpeak sketch, what do I need to change on the PiSpeak sketch to get this to work. All help is appreciated!!!!
- adafruit_support_bill
- Posts: 88092
- Joined: Sat Feb 07, 2009 10:11 am
Re: Wave Shield Programming help...
Just eliminate everything in the "void loop()" function except "playcomplete(filename);" - where the filename is the name of the file you want to play.
-
- Posts: 16
- Joined: Fri Nov 18, 2011 2:55 pm
Re: Wave Shield Programming help...
Thanks, should the same be done if I am using the daphc file for the WaveHC ?
I also want to add pressure sensors to trigger the audio files to start and stop, then once pushed again to play the second audio file, aside from reading from the analog pins what should I be adding or changing.
I also want to add pressure sensors to trigger the audio files to start and stop, then once pushed again to play the second audio file, aside from reading from the analog pins what should I be adding or changing.
- adafruit_support_bill
- Posts: 88092
- Joined: Sat Feb 07, 2009 10:11 am
Re: Wave Shield Programming help...
With the daphc file, the call would be "play(file);"
To add pressure sensors, you wold do an analog read, then test for a threshold value to determine a button press. You will probably have to experiment a bit to find a threshold value that works best for you.also want to add pressure sensors to trigger the audio files
You probably want to go back to the original dapHC code and insert your button test here:to trigger the audio files to start and stop, then once pushed again to play the second audio file
Code: Select all
// WAIT FOR BUTTON PRESS HERE
wave.play(); // make some noise!
while (wave.isplaying) { // playing occurs in interrupts, so we print dots in realtime
putstring(".");
delay(100);
}
-
- Posts: 16
- Joined: Fri Nov 18, 2011 2:55 pm
Re: Wave Shield Programming help...
Thanks. I decided to use a single button and then switch to the next audio file once it is pressed....I am using the sample code found here: http://www.ladyada.net/media/wavshield/ ... teonce.pde
How can I change the code so that rather then having 2 or 5 separate buttons, once the button is pressed again it moves to the next file, I would like to keep the playcomplete and have it only switch once the audio track currently playing is done....
Thanks for all the help.
How can I change the code so that rather then having 2 or 5 separate buttons, once the button is pressed again it moves to the next file, I would like to keep the playcomplete and have it only switch once the audio track currently playing is done....
Thanks for all the help.
- adafruit_support_bill
- Posts: 88092
- Joined: Sat Feb 07, 2009 10:11 am
Re: Wave Shield Programming help...
Something like this:once the button is pressed again it moves to the next file, I would like to keep the playcomplete and have it only switch once the audio track currently playing is done....
Code: Select all
void waitForPress()
{
// loop until the button is pressed
// (inverse logic - use internal pullups)
while(digitalRead(buttonPin) == HIGH){}
}
void loop() {
byte i;
waitForPress();
playcomplete("DO.WAV");
waitForPress();
playcomplete("RE.WAV");
waitForPress();
playcomplete("MI.WAV");
waitForPress();
playcomplete("FA.WAV");
waitForPress();
playcomplete("SO.WAV");
waitForPress();
playcomplete("LA.WAV");
waitForPress();
}
Please be positive and constructive with your questions and comments.