Sd card
Dependencies: mbed SDFileSystem
main.cpp
- Committer:
- mariangelamone
- Date:
- 2022-02-06
- Revision:
- 4:33450cfd53f3
- Parent:
- 3:f281a7095433
File content as of revision 4:33450cfd53f3:
#include "mbed.h" #include "SDFileSystem.h" DigitalOut myled(PB_1); Serial pc(SERIAL_TX, SERIAL_RX); SDFileSystem sd(D11, D12, D13, D4, "sd"); int main(){ wait(1.0); pc.printf("Start.\n\r"); FILE *fp = fopen("/sd/test.csv", "w"); //FILE *fp = fopen("/sd/test.txt", "w"); if(fp != NULL){ myled = 1; pc.printf("Writing to SDcard......\n\r"); for(int i=1;i<10;i++){ fprintf(fp, "%d\n", i); } fclose(fp); myled = 0; } else{ pc.printf("Failed.\n\r"); } pc.printf("End.\n\r"); }