Reproducir audio

Dependencies:   mbed wave_player SDFileSystem TextLCD

Files at this revision

API Documentation at this revision

Comitter:
elpunkixi
Date:
Mon Jul 08 14:54:14 2019 +0000
Parent:
1:e4d7342be507
Commit message:
Rerproducir musica;

Changed in this revision

TextLCD.lib Show annotated file Show diff for this revision Revisions of this file
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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Mon Jul 08 14:54:14 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/simon/code/TextLCD/#308d188a2d3a
--- a/main.cpp	Tue May 16 05:18:55 2017 +0000
+++ b/main.cpp	Mon Jul 08 14:54:14 2019 +0000
@@ -1,19 +1,51 @@
 #include "mbed.h"
+#include "TextLCD.h"
 #include "SDFileSystem.h"
- 
-SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
- 
-int main() {
-    printf("Hello World!\n");   
- 
-    mkdir("/sd/mydir", 0777);
+#include "wave_player.h"
+
+
+
+AnalogOut DACout(PTE30);
+wave_player waver(&DACout);
+SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd"); // Pines del modulo sd
+
+
+Serial pc (USBTX,USBRX);// Comunicacion serial con el pc
+float p,q,w;
+int sel;
+
+
+void receivedByte()// Interrupcion pc
+{
+    int byteReceived = pc.getc();//Variable que viene del pc
+
+    switch (byteReceived) {
+
+            case 'x' :// Segunda etapa: Primera terapia calma -.-
+          sel=1;
+           
+            break;
+
+     
+    }
+}
+
+int main()
+{
+  
+    pc.baud(9600);
+    pc.attach(&receivedByte);
+       
+
     
-    FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
-    if(fp == NULL) {
-        error("Could not open file for write\n");
+    FILE *wave_file;
+    while(1) {
+        if (sel == 1) {
+
+            wave_file = fopen("/sd/AUDIO.wav", "r");
+            waver.play(wave_file);
+            fclose(wave_file);
+                           }
+      
     }
-    fprintf(fp, "Hello fun SD Card World!");
-    fclose(fp); 
- 
-    printf("Goodbye World!\n");
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wave_player.lib	Mon Jul 08 14:54:14 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/sravet/code/wave_player/#acc3e18e77ad