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:
simon
Date:
Thu Nov 19 14:04:44 2009 +0000
Revision:
0:666a082cf50f
Child:
1:2dec995d53f8

        

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
simon 0:666a082cf50f 4 SDFileSystem sd(p11, p12, p13, p28, "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 0:666a082cf50f 13 fprintf(fp, "Hello 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 }