Proyecto digitales avanzados Daniel Olarte y Diego Rodriguez

Dependencies:   BMP180 Lab4_4180 RTC SDFileSystem mbed

Fork of nucleo_sdcard_IV by Marvin Villamizar

Committer:
Digitalesavanzados
Date:
Sun Nov 27 15:18:43 2016 +0000
Revision:
2:1a8e1288573a
Parent:
1:ea59a24226fc
Proyecto digitales avanzados Daniel Olarte y Diego Rodriguez

Who changed what in which revision?

UserRevisionLine numberNew contents of line
teknoarge 0:b0bc1d4fe0d4 1 #include "mbed.h"
teknoarge 0:b0bc1d4fe0d4 2 #include "SDFileSystem.h"
teknoarge 0:b0bc1d4fe0d4 3
teknoarge 0:b0bc1d4fe0d4 4 SDFileSystem sd(D11, D12, D13, D4, "sd"); // the pinout on the mbed Cool Components workshop board
dimmu8410 1:ea59a24226fc 5 Serial pc(USBTX,USBRX);
teknoarge 0:b0bc1d4fe0d4 6 int main() {
dimmu8410 1:ea59a24226fc 7 pc.printf("Iniciando envío\n\r");
teknoarge 0:b0bc1d4fe0d4 8
teknoarge 0:b0bc1d4fe0d4 9 mkdir("/sd/mydir", 0777);
teknoarge 0:b0bc1d4fe0d4 10
dimmu8410 1:ea59a24226fc 11 FILE *fp = fopen("/sd/mydir/BARRIOS.txt", "w");
teknoarge 0:b0bc1d4fe0d4 12 if(fp == NULL) {
teknoarge 0:b0bc1d4fe0d4 13 error("Could not open file for write\n");
teknoarge 0:b0bc1d4fe0d4 14 }
dimmu8410 1:ea59a24226fc 15 for(int i=0;i<20;i++)
dimmu8410 1:ea59a24226fc 16 {
dimmu8410 1:ea59a24226fc 17 fprintf(fp, "dato1:%d,dato2:%d\n\r",i,i*5);
dimmu8410 1:ea59a24226fc 18 }
dimmu8410 1:ea59a24226fc 19 fclose(fp);
teknoarge 0:b0bc1d4fe0d4 20
dimmu8410 1:ea59a24226fc 21 pc.printf("Termino el envío\n\r");
teknoarge 0:b0bc1d4fe0d4 22 }