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:
4:58e4283f9a59
Parent:
3:3b2b8b0955f9
Child:
5:52d527a45a30

File content as of revision 4:58e4283f9a59:

#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;
    while(1){
        timer.start();
        raccoltaDati();
        //stampaFile("A1xxxxoooooggggggeeeeeeerrrryyyyynhgrgr#2\r\n");
        fprintf(fp, "A1xxxxoooooggggggeeeeeeerrrryyyyynhgrgr#2\r\n");
        timer.stop();
        if(timer.read_ms()>100){
                printf("tempo: %f\n\r", timer.read());
        }
        else{
            wait_ms(100-timer.read_ms());
        }
        timer.reset();
        if (mybutton == 0) {
            chiusuraFile();
            aperturaFile(); 
            wait(1); 
        }
        
        /*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++;*/
        
    }
}