micro SD Card module, Normal SPI CS mode. detail : http://wizard.nestegg.jp/sd.html http://wizard.nestegg.jp/spisetting.html
main.cpp@0:e7f811d99fdb, 2011-07-25 (annotated)
- Committer:
- halfpitch
- Date:
- Mon Jul 25 08:06:37 2011 +0000
- Revision:
- 0:e7f811d99fdb
Rev.A
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
halfpitch | 0:e7f811d99fdb | 1 | #include "mbed.h" |
halfpitch | 0:e7f811d99fdb | 2 | #include "SDFileSystem.h" |
halfpitch | 0:e7f811d99fdb | 3 | |
halfpitch | 0:e7f811d99fdb | 4 | SDFileSystem sd(p5, p6, p7, p8, "sd"); |
halfpitch | 0:e7f811d99fdb | 5 | |
halfpitch | 0:e7f811d99fdb | 6 | int main() { |
halfpitch | 0:e7f811d99fdb | 7 | printf("Hello World!\n"); |
halfpitch | 0:e7f811d99fdb | 8 | |
halfpitch | 0:e7f811d99fdb | 9 | FILE *fp = fopen("/sd/sdtest.txt", "w"); |
halfpitch | 0:e7f811d99fdb | 10 | if(fp == NULL) { |
halfpitch | 0:e7f811d99fdb | 11 | error("Could not open file for write\n"); |
halfpitch | 0:e7f811d99fdb | 12 | } |
halfpitch | 0:e7f811d99fdb | 13 | fprintf(fp, "Hello fun SD Card World!"); |
halfpitch | 0:e7f811d99fdb | 14 | fclose(fp); |
halfpitch | 0:e7f811d99fdb | 15 | |
halfpitch | 0:e7f811d99fdb | 16 | printf("Goodbye World!\n"); |
halfpitch | 0:e7f811d99fdb | 17 | } |