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 nucleo_sdcard by
main.cpp@0:b0bc1d4fe0d4, 2016-02-09 (annotated)
- Committer:
- teknoarge
- Date:
- Tue Feb 09 08:43:49 2016 +0000
- Revision:
- 0:b0bc1d4fe0d4
- Child:
- 1:ea59a24226fc
nucleo f401 sd card project
Who changed what in which revision?
| User | Revision | Line number | New 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 | } |
