Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Nucleo_SoundBoardTest Robot Progetto_finale Progetto_finale_noLCD ... more
soundboard Class Reference
soundboard class Used to control the WTV020SD board from sparkfun Find out more at https://www.sparkfun.com/products/11125 Example: More...
#include <soundboard.h>
Public Member Functions | |
| soundboard (PinName resetPin, PinName clockPin, PinName dataPin, PinName busyPin) | |
| Creates the soundboard class with the specified reset pin, clock pin, data pin and busy pin. | |
| void | reset (void) |
| resets the soundboard | |
| void | play (int) |
| plays the given track, Code will be blocked until the track has finished playing | |
| void | playAsync (int) |
| plays the given track, Code will continue running while the track is playing | |
| void | stop (void) |
| stops play back of the current track, only works if the track was played using playAsync | |
| void | pause (void) |
| pauses the currently playing track, or plays the currently paused track, only works if the track was played using playAsync | |
| void | setVolume (int) |
| sets the volume of the playback. | |
| void | playPerhapsAsync (int) |
| plays if something else is not playing | |
Detailed Description
soundboard class Used to control the WTV020SD board from sparkfun Find out more at https://www.sparkfun.com/products/11125 Example:
#include "mbed.h" #include "soundboard.h" int main(void) { //initialise the soundboard soundboard mySoundBoard(D1, D2, D3, D4); //play track 0 mySoundBoard.play(0); //play track 1 mySoundBoard.playAsync(1); //set the volume as 3 mySoundBoard.setVolume(VOL_3); wait(.5); //set the volume as 7 (max) mySoundBoard.setVolume(VOL_7); wait(.5); //mute the playback, but the playback will continue mySoundBoard.setVolume(MUTE); wait(.5); //pause playback mySoundBoard.pause(); wait(.5); //continue playback mySoundBoard.pause(); wait(.5); //reset the soundboard. mySoundBoard.reset(); while(1); }
Definition at line 54 of file soundboard.h.
Constructor & Destructor Documentation
| soundboard | ( | PinName | resetPin, |
| PinName | clockPin, | ||
| PinName | dataPin, | ||
| PinName | busyPin | ||
| ) |
Creates the soundboard class with the specified reset pin, clock pin, data pin and busy pin.
Definition at line 5 of file soundboard.cpp.
Member Function Documentation
| void pause | ( | void | ) |
pauses the currently playing track, or plays the currently paused track, only works if the track was played using playAsync
Definition at line 35 of file soundboard.cpp.
| void play | ( | int | trackNum ) |
plays the given track, Code will be blocked until the track has finished playing
- Parameters:
-
<tracknum> the number of the track which should be played
Definition at line 22 of file soundboard.cpp.
| void playAsync | ( | int | trackNum ) |
plays the given track, Code will continue running while the track is playing
- Parameters:
-
<tracknum> the number of the track which should be played
Definition at line 27 of file soundboard.cpp.
| void playPerhapsAsync | ( | int | trackNum ) |
plays if something else is not playing
Definition at line 69 of file soundboard.cpp.
| void reset | ( | void | ) |
resets the soundboard
Definition at line 10 of file soundboard.cpp.
| void setVolume | ( | int | Volume ) |
sets the volume of the playback.
Use VOL_0 through to VOL_7
Definition at line 39 of file soundboard.cpp.
| void stop | ( | void | ) |
stops play back of the current track, only works if the track was played using playAsync
Definition at line 31 of file soundboard.cpp.
Generated on Wed Jul 13 2022 21:16:23 by
1.7.2
WTV020SD Sound Breakout Board