SD Card

Dependencies:   mbed SDFileSystem

main.cpp

Committer:
DonatoSt
Date:
2018-12-18
Revision:
5:5e2ec6ce43d8
Parent:
3:5edc67dee8b7

File content as of revision 5:5e2ec6ce43d8:

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

Serial pc(USBTX, USBRX);
SDFileSystem sd(D11, D12, D13, D10, "sd"); // MOSI, MISO, SCK, CS
FILE *fp;

int main() {
    wait(2);
    pc.printf("Inizio\r\n");
    while(true){
        fp = fopen("/sd/prova.txt","a");
        if (fp == NULL) {
            pc.printf("Errore\r\n");
        } 
        else {
              fprintf(fp, "Prova\n");
             }
            fclose(fp);
            pc.printf("File scritto con successo!\r\n");
        }
    }