Projet tuteuré S2 / Mbed 2 deprecated Carte_SD

Dependencies:   SDFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
maxlh23
Date:
Sat Apr 23 07:21:51 2016 +0000
Commit message:
Enregistrement des infos du GPS sur la carte SD

Changed in this revision

SDFileSystem.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 2a7418242b56 SDFileSystem.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Sat Apr 23 07:21:51 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/neilt6/code/SDFileSystem/#6bb3c1987511
diff -r 000000000000 -r 2a7418242b56 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Apr 23 07:21:51 2016 +0000
@@ -0,0 +1,43 @@
+#include "mbed.h"
+#include "SDFileSystem.h"
+
+SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "card"); // the pinout on the mbed Cool Components workshop board
+Serial pc(USBTX, USBRX); // tx, rx
+Serial gps(D1, D0);  // tx, rx
+DigitalOut led1(LED1);
+InterruptIn button(PTA4);
+
+FILE *fp;
+int run =1;
+
+void callback() {
+   char s = gps.getc();
+   fprintf(fp, &s);
+   //pc.printf(&s);   a enlever si on veut voir les infos du gps en continu sur le terminal
+} 
+void stop() {
+   run =0;
+}
+int main() {
+
+   pc.printf("Initialized recording\n");   
+   gps.baud(9600);
+   pc.baud(9600);
+   mkdir("/card/gps_tracking", 0777);
+
+   fp = fopen("/card/gps_tracking/sdfile.txt", "w");
+   if(fp == NULL) {
+       error("Could not open file for write\n");
+   }
+   gps.attach(&callback);
+   pc.attach(&stop);
+   button.rise(&stop);
+
+   while(run==1) {
+       led1 = !led1;
+       wait(0.5);
+   }
+   fclose(fp); 
+
+   pc.printf("Recording finished.\n");
+}
diff -r 000000000000 -r 2a7418242b56 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Apr 23 07:21:51 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/082adc85693f
\ No newline at end of file