Carlos Gerena / Mbed 2 deprecated TransversalProyect_copy

Dependencies:   mbed wave_player SDFileSystem TextLCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "TextLCD.h"
00003 #include "SDFileSystem.h"
00004 #include "wave_player.h"
00005 
00006 
00007 
00008 AnalogOut DACout(PTE30);
00009 wave_player waver(&DACout);
00010 SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd"); // Pines del modulo sd
00011 
00012 
00013 Serial pc (USBTX,USBRX);// Comunicacion serial con el pc
00014 float p,q,w;
00015 int sel;
00016 
00017 
00018 void receivedByte()// Interrupcion pc
00019 {
00020     int byteReceived = pc.getc();//Variable que viene del pc
00021 
00022     switch (byteReceived) {
00023 
00024             case 'x' :// Segunda etapa: Primera terapia calma -.-
00025           sel=1;
00026            
00027             break;
00028 
00029      
00030     }
00031 }
00032 
00033 int main()
00034 {
00035   
00036     pc.baud(9600);
00037     pc.attach(&receivedByte);
00038        
00039 
00040     
00041     FILE *wave_file;
00042     while(1) {
00043         if (sel == 1) {
00044 
00045             wave_file = fopen("/sd/AUDIO.wav", "r");
00046             waver.play(wave_file);
00047             fclose(wave_file);
00048                            }
00049       
00050     }
00051 }