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-12-13
Revision:
9:7f0c1261e905
Parent:
7:098d0077f543
Child:
11:3b5e035ffef9

File content as of revision 9:7f0c1261e905:

#include "mbed.h"
#include "setting.h"
#include "lettoreSD.h"
#include "accellerometro.h"
            
DigitalIn mybutton(USER_BUTTON);            
            
int main() {
    init();  
    initFile();
    initAccellerometro();
    aperturaFile(); 
    
    Timer timer;
    
    while(1){ 
        
        timer.start();
        raccoltaDati();
        //stampaFile("A1xxxxoooooggggggeeeeeeerrrryyyyynhgrgr#2\r\n");
        //fprintf(fp, "A1xxxxoooooggggggeeeeeeerrrryyyyynhgrgr#2\r\n");
        timer.stop();
        if(timer.read_ms()>10){
                int overTime = (timer.read_ms() / 10) + 1;
                pc.printf("tempo: %d e overtime %d\n\r ", timer.read_ms(), overTime);
                for (int i=0; i<overTime; i++){
                    fprintf(fp,"#\n\r");
                } 
        }
        else{
            wait_ms(10-timer.read_ms());
            //printf("tempo: %f\n\r", timer.read());
        }
        timer.reset();
        if (mybutton == 0) {
            //chiusuraFile();
            //aperturaFile(); 
            fprintf(fp, "###########FLAG MARCATORE PRESSIONE PULSANTE############\r\n");
            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++;*/
    }
}