SDFileSystem

Dependencies:   mbed PowerControl SDFileSystem

Fork of SDFilesystem by 智也 大野

Committer:
MEXT1
Date:
Thu Dec 15 04:53:16 2016 +0000
Revision:
3:e61ac065965e
Parent:
2:d8e8144373cc
SDFileSystem

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tomoya123 0:8d235efb1150 1 #include "mbed.h"
tomoya123 0:8d235efb1150 2 #include "SDFileSystem.h"
tomoya123 1:47daa1a922c4 3
tomoya123 0:8d235efb1150 4 Serial pc(USBTX,USBRX);
tomoya123 0:8d235efb1150 5 SDFileSystem sd(p11, p12, p13, p15, "sd");
tomoya123 0:8d235efb1150 6
tomoya123 0:8d235efb1150 7 int main() {
tomoya123 1:47daa1a922c4 8 pc.baud(9600);
tomoya123 0:8d235efb1150 9 pc.printf("Hello world!\r\n");
tomoya123 1:47daa1a922c4 10 char str[100];
tomoya123 1:47daa1a922c4 11 mkdir("/sd/mydir", 0777);
tomoya123 1:47daa1a922c4 12 FILE *fp = fopen("/sd/mydir/sdtest.txt","w");
tomoya123 0:8d235efb1150 13 if(fp == NULL) {
tomoya123 0:8d235efb1150 14 error("Could not open file for write\r\n");
tomoya123 0:8d235efb1150 15 }
tomoya123 0:8d235efb1150 16 for(int i=0;i<10;i++)fprintf(fp,"Hello my name is HEPTA!\r\n");
tomoya123 0:8d235efb1150 17 fclose(fp);
tomoya123 0:8d235efb1150 18 fp = fopen("/sd/mydir/sdtest.txt","r");
tomoya123 1:47daa1a922c4 19 fgets(str,100,fp);
tomoya123 1:47daa1a922c4 20 puts(str);
tomoya123 0:8d235efb1150 21 fclose(fp);
MEXT1 3:e61ac065965e 22 pc.printf("Goodbye!!\r\n");
tomoya123 0:8d235efb1150 23 }