Speaker Code

Dependencies:   SDFileSystem mbed wave_player

main.cpp

Committer:
emanuel22e
Date:
23 months ago
Revision:
2:f04e2e446c74
Parent:
0:bdbd3d6fc5d5
Child:
3:8ebd761c0483

File content as of revision 2:f04e2e446c74:

#include "mbed.h"
#include "SDFileSystem.h"
#include "wave_player.h"
SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
AnalogOut speaker(p26); 
wave_player waver(&speaker);
int main() {
    FILE *wave_file;
    //open wav file and play it
    wave_file=fopen("/sd/thread_sound.wav","r");
    waver.play(wave_file);
    fclose(wave_file);
    //end of program
    wait(.2);
}