based on another example

Dependencies:   SDFileSystem mbed

Fork of nucleo_sdcard by emin demir

main.cpp

Committer:
dimmu8410
Date:
2016-10-26
Revision:
1:ea59a24226fc
Parent:
0:b0bc1d4fe0d4

File content as of revision 1:ea59a24226fc:

#include "mbed.h"
#include "SDFileSystem.h"
 
SDFileSystem sd(D11, D12, D13, D4, "sd"); // the pinout on the mbed Cool Components workshop board
Serial pc(USBTX,USBRX); 
int main() {
    pc.printf("Iniciando envío\n\r");   
 
    mkdir("/sd/mydir", 0777);
    
    FILE *fp = fopen("/sd/mydir/BARRIOS.txt", "w");
    if(fp == NULL) {
        error("Could not open file for write\n");
    }
    for(int i=0;i<20;i++)
    {
      fprintf(fp, "dato1:%d,dato2:%d\n\r",i,i*5);
    }
      fclose(fp); 
 
    pc.printf("Termino el envío\n\r");
}