final design project
Dependencies: SDFileSystem TextLCD mbed wave_player
main.cpp
- Committer:
- lenhardt
- Date:
- 2014-11-20
- Revision:
- 0:462dcb4093f2
File content as of revision 0:462dcb4093f2:
#include "mbed.h" #include "SDFileSystem.h" #include "wave_player.h" SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card Ticker tick; AnalogIn fsr(p15); PwmOut led(p26); Serial term(USBTX, USBRX); AnalogOut DACout(p18); wave_player waver(&DACout); FILE *wave_file; void playthisbitch() { //FILE *wave_file; //wave_file=fopen("/sd/sample.wav","r"); //waver.play(wave_file); } int main() { //FILE *wave_file; //wave_file=fopen("/sd/sample.wav","r"); //waver.play(wave_file); float reading; while (1){ reading = (float)fsr; term.printf("\nReading is: %f\r", (float)fsr); led = 0.0f; led = (float)fsr; wait(.1); if( (float)fsr > .02){ //tick.detach(); //tick.attach(&playthisbitch, 500000); //tick.detach(); wave_file=fopen("/sd/sample.wav","r"); waver.play(wave_file); } wait_us(500); } fclose(wave_file); } /* #include "mbed.h" #include "SDFileSystem.h" #include "wave_player.h" SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card AnalogOut DACout(p18); wave_player waver(&DACout); int main() { FILE *wave_file; printf("\n\n\nHello, wave world!\n"); wave_file=fopen("/sd/sample.wav","r"); waver.play(wave_file); fclose(wave_file); }*/