![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
//平台nucleo+mbed+SD卡模块
Dependencies: SDFileSystem mbed
Diff: main.cpp
- Revision:
- 0:6b3e023fa7c1
--- /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