Unina Corse EL / Mbed 2 deprecated f4_sd_imu_4

Dependencies:   SDFileSystem_conMOD mbed-rtos mbed

Fork of f4_sd_imu_4 by ratto killer

Revision:
3:3b2b8b0955f9
Parent:
2:f59bd5312559
Child:
4:58e4283f9a59
--- a/main.cpp	Mon Nov 20 22:18:10 2017 +0000
+++ b/main.cpp	Wed Nov 22 02:41:36 2017 +0000
@@ -1,22 +1,41 @@
 #include "mbed.h"
 #include "setting.h"
 #include "lettoreSD.h"
-
-
+#include "accellerometro.h"
+            
+DigitalIn mybutton(USER_BUTTON);            
+            
 int main() {
-    init();
-    printf("Hello World!\n\r");
-    initFile();  
-    aperturaFile();
+    init();  
+    initFile();
+    initAccellerometro();
+    aperturaFile(); 
+    /*aperturaFile();
     for(int i=0; i<1000; i++){
         stampaFile("A1xxxxoooooggggggeeeeeeerrrryyyyynhgrgr#2\r\n");
-    }
-    chiusuraFile(); 
-    aperturaFile();
-    for(int i=0; i<1000; i++){
-        stampaFile("A1xxxxoooooggggggeeeeeeerrrryyyyynhgrgr#2\r\n");
-    }
+    }           
     chiusuraFile(); 
     printf("Goodbye World!\n\r");
-    
+    raccoltaDati();*/
+    Timer timer;
+    int i=0;
+    timer.start();
+    while(1){
+        raccoltaDati();
+        stampaFile("A1xxxxoooooggggggeeeeeeerrrryyyyynhgrgr#2\r\n");
+        if(i%100==99){
+            timer.stop();
+            float tempo = 1 - timer.read();
+            wait(tempo);
+            printf("tempo: %f\n\r", tempo + timer.read());
+            timer.reset();
+            timer.start();  
+        }
+        i++;
+        if (mybutton == 0) {
+            chiusuraFile();
+            aperturaFile(); 
+            wait(0.5); 
+        }
+    }
 }