wav player
Dependencies: mbed wave_player sd_kart_yazma_okma
Revision 2:46a454954f4b, committed 2019-12-29
- Comitter:
- marvas
- Date:
- Sun Dec 29 08:42:00 2019 +0000
- Parent:
- 1:2baac9785cda
- Commit message:
- wav player
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
wave_player.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r 2baac9785cda -r 46a454954f4b main.cpp --- a/main.cpp Sun Dec 29 07:37:59 2019 +0000 +++ b/main.cpp Sun Dec 29 08:42:00 2019 +0000 @@ -1,40 +1,16 @@ #include "mbed.h" #include "SDFileSystem.h" +#include "wave_player.h" SDFileSystem sd(PB_5, PB_4, PB_3, PA_8, "BTT"); // mosi, miso, sclk, cs(scl) -unsigned char c; +AnalogOut DACout(PA_5); +wave_player waver(&DACout); int main() { - mkdir("/BTT", 0777); -//mkdir klasör oluşturur. -//0777 dosyaya veri yazıp okumayı etkinleştirir. - while(1) { - wait_ms(500); - FILE *fp = fopen("/BTT/index.txt", "a"); - /* a - dosyanın içerisine var olan verinin yanına ekleme yapar - r - Dosyadan okuma yapar - w - Dosyadan verileri siler yeni veriyi ekler. - */ - if(fp == NULL) { - error("Yazma icin dosya acilamadi \n"); - printf("Yazma icin dosya acilamadi \n"); - } - - else { - //Sd karta yazar - fprintf(fp, "ismek fatih bilisim okulu\n"); - fclose(fp); //Dosya kapat -// - FILE *fpr = fopen("/BTT/index.txt", "r"); - //Okunacak dosya seçildi - -//file end of. Okuma işlemi bitene kadar devam et. -//Dosya sonuna kadar okumaya devam et. - while (!feof(fpr)) { - c=fgetc(fpr); - printf("%c",c); - } - fclose(fpr); - } - } + //mkdir("/BTT", 0777); + + FILE *wave_file; + wave_file=fopen("/BTT/mv2.wav","r"); + waver.play(wave_file); + fclose(wave_file); } \ No newline at end of file
diff -r 2baac9785cda -r 46a454954f4b wave_player.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wave_player.lib Sun Dec 29 08:42:00 2019 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/sravet/code/wave_player/#acc3e18e77ad