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: USBDevice USBMSD_SD mbed
Fork of USBMSD_SD_HelloWorld_Mbed by
main.cpp@8:534fd41d8cc7, 2011-11-14 (annotated)
- Committer:
- samux
- Date:
- Mon Nov 14 17:50:02 2011 +0000
- Revision:
- 8:534fd41d8cc7
- Parent:
- 7:6494da2a5c60
- Child:
- 9:9c343b9ee6d8
doesn\'t work...
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| samux |
2:27a7e7f8d399 | 1 | #include "mbed.h" |
| samux |
7:6494da2a5c60 | 2 | #include "SDFileSystem.h" |
| samux |
2:27a7e7f8d399 | 3 | |
| samux |
8:534fd41d8cc7 | 4 | SDFileSystem sd(p5, p6, p7, p8, "sd"); |
| samux |
8:534fd41d8cc7 | 5 | Serial pc(USBTX, USBRX); |
| samux |
2:27a7e7f8d399 | 6 | |
| samux |
2:27a7e7f8d399 | 7 | int main() { |
| samux |
8:534fd41d8cc7 | 8 | |
| samux |
8:534fd41d8cc7 | 9 | //connect USB SD card |
| samux |
8:534fd41d8cc7 | 10 | sd.connect(); |
| samux |
2:27a7e7f8d399 | 11 | while(1); |
| samux |
8:534fd41d8cc7 | 12 | |
| samux |
8:534fd41d8cc7 | 13 | mkdir("/sd/dir", 0777); |
| samux |
8:534fd41d8cc7 | 14 | |
| samux |
8:534fd41d8cc7 | 15 | FILE *fp = fopen("/sd/dir/file.txt", "w"); |
| samux |
8:534fd41d8cc7 | 16 | if (fp == NULL) { |
| samux |
8:534fd41d8cc7 | 17 | error("Could not open file for write\n"); |
| samux |
8:534fd41d8cc7 | 18 | } |
| samux |
8:534fd41d8cc7 | 19 | fprintf(fp, "Hello fun SD Card World!"); |
| samux |
8:534fd41d8cc7 | 20 | fclose(fp); |
| samux |
8:534fd41d8cc7 | 21 | while(1); |
| samux |
2:27a7e7f8d399 | 22 | } |
