Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem mbed
Fork of SDFileSystem_HelloWorld by
Revision 2:886ae0153478, committed 2017-10-05
- Comitter:
- martinsimpson
- Date:
- Thu Oct 05 10:49:22 2017 +0000
- Parent:
- 1:e4d7342be507
- Child:
- 3:b97a5c596320
- Commit message:
- wrk
Changed in this revision
| SDFileSystem.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/SDFileSystem.lib Tue May 16 05:18:55 2017 +0000 +++ b/SDFileSystem.lib Thu Oct 05 10:49:22 2017 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/SDFileSystem/#8db0d3b02cec +http://mbed.org/users/mbed_official/code/SDFileSystem/#239357aa5cf3
--- a/main.cpp Tue May 16 05:18:55 2017 +0000
+++ b/main.cpp Thu Oct 05 10:49:22 2017 +0000
@@ -1,10 +1,12 @@
#include "mbed.h"
#include "SDFileSystem.h"
-SDFileSystem sd(p5, p6, p7, p8, "sd"); // the pinout on the mbed Cool Components workshop board
-
+SDFileSystem sd(D11, D12, D13, D10, "sd"); // the pinout on the mbed Cool Components workshop board
+
+char myStr[128];
+
int main() {
- printf("Hello World!\n");
+ printf("Start to write!\n");
mkdir("/sd/mydir", 0777);
@@ -12,8 +14,16 @@
if(fp == NULL) {
error("Could not open file for write\n");
}
- fprintf(fp, "Hello fun SD Card World!");
+ fprintf(fp, "Hello World!");
+ fprintf(fp, "This is a second line");
+ fprintf(fp, "and now a third line");
fclose(fp);
- printf("Goodbye World!\n");
+ printf("Finished writing and closed file\n");
+
+ FILE *fp1 = fopen("/sd/mydir/sdtest.txt", "r");
+ //fscanf(fp1, "%s", myStr);
+ fgets(myStr, 12, fp1);
+ printf("\t%s\n\r",myStr);
+ fclose(fp1);
}
