Senior_Design_Sailboat / Mbed 2 deprecated ECE4012_Sailboat

Dependencies:   mbed Servo SDFileSystem

Files at this revision

API Documentation at this revision

Comitter:
taoqiuyang
Date:
Fri Aug 28 08:04:57 2015 +0000
Parent:
18:9a30764847d2
Child:
20:a820531c78bc
Commit message:
SD card added

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Fri Aug 28 08:04:57 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/mbed_official/code/SDFileSystem/#7b35d1709458
--- a/main.cpp	Fri Aug 28 07:49:06 2015 +0000
+++ b/main.cpp	Fri Aug 28 08:04:57 2015 +0000
@@ -4,6 +4,7 @@
 #include <vector>
 #include "Get.h"
 #include "Servo.h"
+#include "SDFileSystem.h"
 using namespace std;
 
 #define MAX_IMU_SIZE 29
@@ -20,7 +21,7 @@
 Serial GPS(p13, p14);  // tx, rx
 Servo rudderServo(p25);
 Servo wingServo(p26);
-//rudderservo = 0.5;
+SDFileSystem sd(p5, p6, p7, p8, "sd");// mosi, miso, sck, cs
 
 char IMU_message[256];
 int  IMU_message_counter=0;
@@ -232,6 +233,17 @@
     targetServo=pos;
 }
 
+int log_data_SD(){   
+    FILE *fp = fopen("/sd/dataLog/dataLog.txt", "w");
+    if(fp == NULL) {
+        return 0;
+    }else{
+        //Write all the useful data to the SD card        
+        fprintf(fp, "Nya Pass~");
+        fclose(fp); 
+        return 1;
+    }
+}
  
 int main() {
     IMU.baud(57600);