![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
//平台nucleo+mbed+SD卡模块
Dependencies: SDFileSystem mbed
main.cpp
- Committer:
- anywill
- Date:
- 2016-11-01
- Revision:
- 0:6b3e023fa7c1
File content as of revision 0:6b3e023fa7c1:
//平台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"); }