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-25
Revision:
6:f689244d5d33
Parent:
5:52d527a45a30
Child:
7:098d0077f543

File content as of revision 6:f689244d5d33:

#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()>20){
                printf("tempo: %f\n\r", timer.read());
        }
        else{
            wait_ms(20-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++;*/
        
    }
}