sfgb

Dependencies:   SDFileSystem mbed

Fork of nucleo_sdcard by emin demir

Committer:
teknoarge
Date:
Tue Feb 09 08:43:49 2016 +0000
Revision:
0:b0bc1d4fe0d4
Child:
1:b8b1257a7769
nucleo f401 sd card project

Who changed what in which revision?

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