Write 10 lines of Accelerometer data from FRDM-KL25Z to SD Card and read it back.

Dependencies:   MMA8451Q SDFileSystem mbed

Fork of SDCardTest by Orko Garai

Files at this revision

API Documentation at this revision

Comitter:
kaushik_ray_1
Date:
Tue Dec 30 23:59:23 2014 +0000
Parent:
5:9daddf40654f
Child:
7:dbf3c52ac1b5
Commit message:
Added the Acceleroneter data logging

Changed in this revision

MMA8451Q.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 diff for this revision Revisions of this file
mbed.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MMA8451Q.lib	Tue Dec 30 23:59:23 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/quevedo/code/MMA8451Q/#7c9ab58f6af3
--- a/main.cpp	Tue Dec 30 19:05:09 2014 +0000
+++ b/main.cpp	Tue Dec 30 23:59:23 2014 +0000
@@ -1,17 +1,30 @@
 #include "mbed.h"
 #include "SDFileSystem.h"
+#include "MMA8451Q.h"
 
 SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
+MMA8451Q acc(PTE25,PTE24);
+
+
 
 int main() {
-    printf("Hello World!\n");   
-
+    int16_t data[3];
+    
     FILE *fp = fopen("/sd/sdtest.txt", "w");
     if(fp == NULL) {
         error("Could not open file for write\n");
     }
-    fprintf(fp, "Hello fun SD Card World!");
+    while(1)
+    {
+        acc.getAccAllAxis(data);  
+        fprintf(fp, "%d",data[0]);
+        fprintf(fp, ", %d",data[1]);
+        fprintf(fp, ", %d\n",data[2]);
+ /*       if()
+        {
+            break;
+        }*/
+    }
     fclose(fp); 
-
     printf("Goodbye World!\n");
-}   
+}   
\ No newline at end of file
--- a/mbed.bld	Tue Dec 30 19:05:09 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.lib	Tue Dec 30 23:59:23 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/#4fc01daae5a5