asd

Dependencies:   SDFileSystem mbed

Fork of SDFileSystem_HelloWorld by mbed official

SD card write - fat file system kl46z

Committer:
fblanc92
Date:
Wed Aug 23 17:21:15 2017 +0000
Revision:
2:8a7953dfeccd
Parent:
0:bdbd3d6fc5d5
Child:
3:b2658ae9fc38
SD;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 0:bdbd3d6fc5d5 1 #include "mbed.h"
mbed_official 0:bdbd3d6fc5d5 2 #include "SDFileSystem.h"
fblanc92 2:8a7953dfeccd 3 SDFileSystem sd(PTA16,PTA17,PTA15,PTA14, "sd"); // the pinout on the mbed Cool Components workshop board
fblanc92 2:8a7953dfeccd 4 DigitalOut redLed(LED2);
fblanc92 2:8a7953dfeccd 5 int main()
fblanc92 2:8a7953dfeccd 6 {
fblanc92 2:8a7953dfeccd 7 printf("Hello World!\n");
mbed_official 0:bdbd3d6fc5d5 8 mkdir("/sd/mydir", 0777);
fblanc92 2:8a7953dfeccd 9
mbed_official 0:bdbd3d6fc5d5 10 FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
mbed_official 0:bdbd3d6fc5d5 11 if(fp == NULL) {
mbed_official 0:bdbd3d6fc5d5 12 error("Could not open file for write\n");
mbed_official 0:bdbd3d6fc5d5 13 }
mbed_official 0:bdbd3d6fc5d5 14 fprintf(fp, "Hello fun SD Card World!");
fblanc92 2:8a7953dfeccd 15 fclose(fp);
fblanc92 2:8a7953dfeccd 16
mbed_official 0:bdbd3d6fc5d5 17 printf("Goodbye World!\n");
fblanc92 2:8a7953dfeccd 18
mbed_official 0:bdbd3d6fc5d5 19 }