A library to allow SD Cards to be accessed as a filesystem, using a SPI interface

Dependencies:   SDFileSystem mbed

main.cpp

Committer:
xxwiz
Date:
2014-03-10
Revision:
0:a76f1c9096cb

File content as of revision 0:a76f1c9096cb:

#include "mbed.h"
#include "SDFileSystem.h"
//Nucleo F030R8 test
//DigitalOut myled(LED1);
//              MOSI, MISO, SCLK, CS, name
SDFileSystem sd(PA_7, PA_6, PA_5, PB_6, "sd");

int main() {
    printf("\nWait for new connection...\n");
    
    mkdir("/sd/mydir", 0777);
    
    FILE *fp = fopen("/sd/mydir/sdtest.txt", "w");
    if(fp == NULL) {
        printf("Could not open file for write\n");
    }
    fprintf(fp, "Hello fun SD Card World!");
    fclose(fp); 
    
    while(1) {
        /*
        myled = 1;
        wait(1.2);
        myled = 0;
        wait(1.2);*/
    }
}