Dimas Nugroho / Mbed OS Trisula_Data_Logger

Dependencies:   RTC_Reader SDFileSystem DS3231

main.cpp

Committer:
DimasFN
Date:
2018-11-16
Revision:
0:eb4606c99ae9
Child:
1:cd725fbbcbc2

File content as of revision 0:eb4606c99ae9:


//https://os.mbed.com/users/neilt6/code/SDFileSystem_HelloWorld/

#include "mbed.h"
#include "SDFileSystem.h"

//SDFileSystem::SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name) : 
SDFileSystem sd(D11, D12, D13, D10, "G"); // the pinout on the mbed Cool Components workshop board

int main() {
    printf("SD card test!\r\n");   

    mkdir("/G/mydir", 0777);
    
    FILE *fp = fopen("/G/mydir/TEST.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");
}