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

main.cpp

Committer:
NdA994
Date:
2017-11-22
Revision:
3:3b2b8b0955f9
Parent:
2:f59bd5312559
Child:
4:58e4283f9a59

File content as of revision 3:3b2b8b0955f9:

#include "mbed.h"
#include "setting.h"
#include "lettoreSD.h"
#include "accellerometro.h"
            
DigitalIn mybutton(USER_BUTTON);            
            
int main() {
    init();  
    initFile();
    initAccellerometro();
    aperturaFile(); 
    /*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); 
        }
    }
}