programma di test per vedere se funziona
Dependencies: SDFileSystem_conMOD mbed-rtos mbed
Fork of f4_sd_imu_4 by
main.cpp
00001 #include "mbed.h" 00002 #include "setting.h" 00003 #define f_campionamento 100 // se va male 50 00004 #define debug 00005 00006 DigitalIn mybutton(USER_BUTTON); 00007 Ticker accelerometro; 00008 Thread thread; 00009 Timer tempo; 00010 float temp; 00011 int n=0; 00012 void simula_dati(){ 00013 00014 ax=n++ /100.0; 00015 ay=4.56; 00016 az=-4.358; 00017 //prelivevo dei dati fatto in tempo 00018 float t=tempo.read(); 00019 if((t-temp)>1.0/(2*f_campionamento))pc.printf("problema"); 00020 temp=t; 00021 invia_m(1000*ax+4000,1000*ay+4000,1000*az+4000,0,0,0); 00022 } 00023 00024 int main() { 00025 init(); 00026 initFile(); 00027 00028 //initAccellerometro(); 00029 aperturaFile(); 00030 00031 tempo.reset(); 00032 tempo.start(); 00033 temp=0; 00034 accelerometro.attach(&raccoltaDati,1.0/f_campionamento); 00035 00036 thread.start(callback(scrivi_m)); 00037 00038 00039 while(1){ 00040 Thread::wait(0.01); 00041 if (mybutton) { 00042 00043 invia_m(65535,65535,65535,65535,65535,65535); 00044 00045 Thread::wait(2); 00046 } 00047 00048 00049 } 00050 }
Generated on Thu Jul 14 2022 13:03:23 by
1.7.2
