Code for measuring the signal with a specified length and sampling rate, and saving it on a SD card.

Dependencies:   EALib I2S mbed

Files at this revision

API Documentation at this revision

Comitter:
msamadani
Date:
Thu Oct 05 17:44:39 2017 +0000
Parent:
1:a514e4de034d
Commit message:
A version of the code that initializes the SD RAM, activates the codec, measures the signal and saves the signal onto the SD Card.

Changed in this revision

EALib.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
diff -r a514e4de034d -r 8c5b6522139f EALib.lib
--- a/EALib.lib	Fri Jul 14 14:41:10 2017 +0000
+++ b/EALib.lib	Thu Oct 05 17:44:39 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/embeddedartists/code/EALib/#5ac242986175
+https://os.mbed.com/users/msamadani/code/EALib/#5ac242986175
diff -r a514e4de034d -r 8c5b6522139f main.cpp
--- a/main.cpp	Fri Jul 14 14:41:10 2017 +0000
+++ b/main.cpp	Thu Oct 05 17:44:39 2017 +0000
@@ -23,10 +23,10 @@
 static emxArray_real32_T *argInit_Unboundedx1_real32_T(float* x);
 
 /* Define variables */
-int fs=330000;   // sampling rate
+int fs=33000;   // sampling rate
 int xsize=33000;// signal length;
 int transient=0; // transient part that is cut from the signal
-std::string filename = "noisetest2";  // name of file saved to SD card
+std::string filename = "test";  // name of file saved to SD card
 
 
 Serial pc(USBTX, USBRX);
@@ -56,7 +56,7 @@
     //free(signal_raw);
 
     /*----------------Envelope Analysis-----------------------------*/
-
+/*
     printf("Performing analysis...\n");
     emxArray_real32_T *signal2;
     emxArray_real32_T *fir_coef;
@@ -78,17 +78,19 @@
     emxInitArray_real32_T(&env_signal, 1);
     envSignal(signal2,fir_coef, env_signal);
 
-
+*/
     // Print data to terminal
-    printf("analysis done\n");
+    //printf("analysis done\n");
     for (int i = 5000; i < 5200; i++) {
-        printf("%f            %f          %f\n",signal[i],signal2->data[i],env_signal->data[i]);
+        //printf("%f            %f          %f\n",signal[i],signal2->data[i],env_signal->data[i]);
+        printf("%f           \n");
+
     }
 
 
     /*---------------------------------------------------------------*/
-    //saveToSD(signal,xsize,filename.c_str());  //save data to SD card
-    // saveToSD(signal,xsize,"signal.txt");
+    saveToSD(signal,xsize,filename.c_str());  //save data to SD card
+    //saveToSD(signal,xsize,"signal.txt");
     // saveToSD(env_signal->data,xsize,"envsignal.txt");