simple voice recorder. Pwoer up or reset, record voice for 5 sec. Press botton then voice out.

Dependencies:   mbed

/media/uploads/hayama/2014-08-11_20.21.54.jpg

Files at this revision

API Documentation at this revision

Comitter:
hayama
Date:
Thu Aug 14 09:45:57 2014 +0000
Commit message:
simple voice recorder

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 00a8ac955304 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Aug 14 09:45:57 2014 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+#define NUMDAT 15000
+#define DLY 250
+
+float micCB;
+short dat[NUMDAT];
+int i;
+ 
+DigitalIn sw(p5); 
+AnalogIn micC(p16);     
+AnalogOut spOut(p18);
+BusOut   leds( LED4, LED3, LED2, LED1 );  
+
+void voiceOut(){
+    leds=2;
+    for(i=0;i<NUMDAT; i++){
+        spOut=((float)dat[i])/32768*10+0.5; 
+        wait_us(DLY);
+    }
+}
+
+int main() {
+    leds=0;
+    wait(1);
+    micCB=0;
+    for(i=0;i<100;i++){ micCB+=micC; } 
+    micCB/=100;
+    leds=1;
+    
+    // record voice
+    for(i=0;i<NUMDAT; i++){
+        dat[i]=(int)((micC-micCB)*32768);
+        wait_us(DLY);
+    }
+   
+    while(1){
+        leds=0;
+        if (sw==0) voiceOut();
+    }
+}
+
+
+
diff -r 000000000000 -r 00a8ac955304 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Aug 14 09:45:57 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae
\ No newline at end of file