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

Committer:
ogarai
Date:
Mon Dec 29 07:28:55 2014 +0000
Revision:
4:823307a8e5dc
Parent:
3:68ef62208d4d
Child:
6:f8e5916f19b8
Initial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:666a082cf50f 1 #include "mbed.h"
simon 0:666a082cf50f 2 #include "SDFileSystem.h"
simon 0:666a082cf50f 3
ogarai 4:823307a8e5dc 4 SDFileSystem sd(PTD2, PTD3, PTD1, PTD0, "sd");
simon 0:666a082cf50f 5
simon 0:666a082cf50f 6 int main() {
simon 0:666a082cf50f 7 printf("Hello World!\n");
simon 0:666a082cf50f 8
simon 0:666a082cf50f 9 FILE *fp = fopen("/sd/sdtest.txt", "w");
simon 0:666a082cf50f 10 if(fp == NULL) {
simon 0:666a082cf50f 11 error("Could not open file for write\n");
simon 0:666a082cf50f 12 }
simon 3:68ef62208d4d 13 fprintf(fp, "Hello fun SD Card World!");
simon 0:666a082cf50f 14 fclose(fp);
simon 0:666a082cf50f 15
simon 0:666a082cf50f 16 printf("Goodbye World!\n");
simon 0:666a082cf50f 17 }