A basic wave player demo using the cookbook waveplayer and SD file system examples with a low-cost speaker and transistor

Dependencies:   SDFileSystem mbed wave_player

Fork of SDFileSystem_HelloWorld by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 
00002 #include "mbed.h"
00003 #include "SDFileSystem.h"
00004 #include "wave_player.h"
00005 
00006 
00007 SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card
00008 
00009 AnalogOut DACout(p18);
00010 
00011 wave_player waver(&DACout);
00012 
00013 int main()
00014 {
00015     FILE *wave_file;
00016     printf("\n\n\nHello, wave world!\n");
00017     wave_file=fopen("/sd/sample.wav","r");
00018     waver.play(wave_file);
00019     fclose(wave_file);
00020 }