Log measurements on SD card added on DISCO-L476VG board acceleration, omega, compass & 5 Analog values

Dependencies:   BSP_DISCO_L476VG COMPASS_DISCO_L476VG ConfigFile GYRO_DISCO_L476VG SDFileSystem mbed

Committer:
flowh
Date:
Fri Feb 12 20:54:38 2016 +0000
Revision:
0:0861bf46efe4
Child:
1:e1f3b4b8b99b
enregistrement Acc et boussole sur sd

Who changed what in which revision?

UserRevisionLine numberNew contents of line
flowh 0:0861bf46efe4 1 #include "mbed.h"
flowh 0:0861bf46efe4 2 #include "DataFile.h"
flowh 0:0861bf46efe4 3
flowh 0:0861bf46efe4 4 #include "SDFileSystem.h"
flowh 0:0861bf46efe4 5 #include "COMPASS_DISCO_L476VG.h"
flowh 0:0861bf46efe4 6
flowh 0:0861bf46efe4 7
flowh 0:0861bf46efe4 8 DigitalOut LedEnreg(LED1);
flowh 0:0861bf46efe4 9 DigitalIn InterEnreg(PD_0,PullDown);
flowh 0:0861bf46efe4 10
flowh 0:0861bf46efe4 11 COMPASS_DISCO_L476VG compass ;
flowh 0:0861bf46efe4 12
flowh 0:0861bf46efe4 13 //Create an SDFileSystem object
flowh 0:0861bf46efe4 14 SDFileSystem sd(PE_15, PE_14, PE_13, PE_12, "sd");
flowh 0:0861bf46efe4 15 tDataFile DataFile;
flowh 0:0861bf46efe4 16 bool EnregistrementEnCours;
flowh 0:0861bf46efe4 17
flowh 0:0861bf46efe4 18 //COMPASS_DISCO_L476VG compass ;//=new COMPASS_DISCO_L476VG();
flowh 0:0861bf46efe4 19
flowh 0:0861bf46efe4 20 tMesure Mesures(&compass);
flowh 0:0861bf46efe4 21
flowh 0:0861bf46efe4 22
flowh 0:0861bf46efe4 23 void Init()
flowh 0:0861bf46efe4 24 {
flowh 0:0861bf46efe4 25 printf("avant Compass created\n");
flowh 0:0861bf46efe4 26 //pcompass =new COMPASS_DISCO_L476VG();
flowh 0:0861bf46efe4 27 printf("Compass created\n");
flowh 0:0861bf46efe4 28 // delete pcompass;
flowh 0:0861bf46efe4 29 EnregistrementEnCours=false;
flowh 0:0861bf46efe4 30 LedEnreg=0;
flowh 0:0861bf46efe4 31 printf("Compass started\n");
flowh 0:0861bf46efe4 32
flowh 0:0861bf46efe4 33 //Mount the filesystem
flowh 0:0861bf46efe4 34 sd.mount();
flowh 0:0861bf46efe4 35 printf("mounted\n\r");
flowh 0:0861bf46efe4 36 }
flowh 0:0861bf46efe4 37
flowh 0:0861bf46efe4 38 void CheckEnreg()
flowh 0:0861bf46efe4 39 {
flowh 0:0861bf46efe4 40 if (InterEnreg.read()==1)
flowh 0:0861bf46efe4 41 {
flowh 0:0861bf46efe4 42 //printf("InterEnreg\n\r");
flowh 0:0861bf46efe4 43 if (!EnregistrementEnCours)
flowh 0:0861bf46efe4 44 {
flowh 0:0861bf46efe4 45 EnregistrementEnCours=true;
flowh 0:0861bf46efe4 46 DataFile.New();
flowh 0:0861bf46efe4 47 printf("enregistrement started\n\r");
flowh 0:0861bf46efe4 48 }
flowh 0:0861bf46efe4 49 else
flowh 0:0861bf46efe4 50 {
flowh 0:0861bf46efe4 51 DataFile.SaveMesures(&Mesures);
flowh 0:0861bf46efe4 52 //printf("Enregistrement\n\r");
flowh 0:0861bf46efe4 53 }
flowh 0:0861bf46efe4 54 LedEnreg=!LedEnreg;
flowh 0:0861bf46efe4 55
flowh 0:0861bf46efe4 56 }
flowh 0:0861bf46efe4 57 else
flowh 0:0861bf46efe4 58 {
flowh 0:0861bf46efe4 59 //printf("Not InterEnreg\n\r");
flowh 0:0861bf46efe4 60 if (EnregistrementEnCours)
flowh 0:0861bf46efe4 61 {
flowh 0:0861bf46efe4 62 EnregistrementEnCours=false;
flowh 0:0861bf46efe4 63 DataFile.Close();
flowh 0:0861bf46efe4 64 printf("enregistrement stopped\n\r");
flowh 0:0861bf46efe4 65 }
flowh 0:0861bf46efe4 66 LedEnreg=0;
flowh 0:0861bf46efe4 67 }
flowh 0:0861bf46efe4 68 }