//平台nucleo+mbed+SD卡模块

Dependencies:   SDFileSystem mbed

Files at this revision

API Documentation at this revision

Comitter:
anywill
Date:
Tue Nov 01 03:47:57 2016 +0000
Commit message:
//??nucleo+mbed+SD???

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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SDFileSystem.lib	Tue Nov 01 03:47:57 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/neilt6/code/SDFileSystem/#e4d2567200db
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Nov 01 03:47:57 2016 +0000
@@ -0,0 +1,23 @@
+//平台nucleo+mbed+SD卡模块
+//读写实验
+#include "mbed.h"
+#include "SDFileSystem.h"
+//mbed SD Card tutorial
+SDFileSystem sd(D11, D12, D13, D10, "sd"); // the pinout on the mbed Cool Components workshop board
+//原平台LPC1768 (p11, p12, p13, p8, "sd");
+//              mosi,miso,sck,cs,
+//  nucleo       D11,D12,D13,D10  
+int main() {
+    printf("SD card test!\r\n");   
+
+    mkdir("/sd/mydir", 0777);
+    
+    FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
+    if(fp == NULL) {
+        error("Could not open file for write\r\n");
+    }
+    fprintf(fp, "Hello fun SD Card World!\r\n");
+    fclose(fp); 
+
+    printf("File successfully written and closed!\r\n");
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Nov 01 03:47:57 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/25aea2a3f4e3
\ No newline at end of file