SD card file helloworld demo using new mbed RTOS ver 5 file driver setup. Pins setup for LPC1768 - read comment in code about project's json file requirements for adding the SD filesystem driver
SD card r/w demo for mbed OS version 5 on LPC1768.
File drivers are added in json file with "target.components_add": ["SD"] for use in most recent OS 5 version.
Test messages are sent to serial port with printf's.
main.cpp
- Committer:
- 4180_1
- Date:
- 2019-09-11
- Revision:
- 0:3588d7473dce
- Child:
- 1:3a59eb72e0cf
File content as of revision 0:3588d7473dce:
#include "mbed.h" // Need "target.components_add": ["SD"] in json project file! #include "SDBlockDevice.h" #include "FATFileSystem.h" SDBlockDevice sd(p5, p6, p7, p8); FATFileSystem fs("SD"); int main() { sd.init(); fs.mount(&sd); FILE* fd = fopen("/SD/hi.txt", "w"); fprintf(fd, "hello!\n\r"); fclose(fd); sd.deinit(); fs.unmount(); }