funziona

Dependencies:   SDFileSystem_motore mbed

Fork of SDFileSystem_HelloWorld by mbed official

Revision:
3:4d9b3d817b27
Parent:
2:88534a51c2b4
--- a/main.cpp	Fri Feb 09 11:57:16 2018 +0000
+++ b/main.cpp	Fri Feb 09 15:51:34 2018 +0000
@@ -8,9 +8,12 @@
 Serial pc(USBTX, USBRX); // tx, rx
 
 SDFileSystem sd(A6, A5, A4, A3, "sd"); // the pinout on the mbed Cool Components workshop board
+int n = 0;
  
 FILE *fp; 
 
+DigitalIn mybutton(D1);            
+
 int rpm;
  
 typedef struct {
@@ -86,6 +89,15 @@
         if((can.rderror()+can.tderror()))pc.printf("Errori! : rd: %d\t td: %d\r\n",can.rderror(),can.tderror());   
         wait_us(10);
         }
+        if (mybutton == 0) {
+            //chiusuraFile();
+            //aperturaFile(); 
+            //fprintf(fp, "###########FLAG MARCATORE PRESSIONE PULSANTE############\r\n");
+            fprintf(fp, "NN %d\n\r", n);
+            printf("flag\n\r");
+            n++;
+            wait(1); 
+        }
     }
     //fclose(fp);