Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: SDFileSystem mbed
Fork of MemoriaSD by
main.cpp
00001 #include "mbed.h" 00002 #include "SDFileSystem.h" 00003 00004 Serial pc(USBTX, USBRX); 00005 SDFileSystem sd(PTD2, PTD3, PTD1, PT, "sd"); 00006 00007 00008 int main() { 00009 pc.baud(9600); 00010 pc.printf("Bienvenido"); 00011 char f[10] = {"/sd/mydir"}; 00012 char fll[23] = {"/sd/mydir/archivo1.txt"}; 00013 char datos[1024]={0}; 00014 char *carpeta; 00015 char *archivo; 00016 int serial=0; 00017 int i = 0; 00018 char terminante = 0; 00019 carpeta = &f[0]; 00020 archivo = &fll[0]; 00021 mkdir("/sd/",0777); 00022 mkdir(carpeta,0777); 00023 FILE *fl = fopen(archivo, "w"); 00024 if(fl == NULL) { 00025 error("Could not open file for write\n"); 00026 } 00027 i = 0; 00028 pc.printf("\nEl archivo se llama archivo1.txt \n\r"); 00029 pc.printf("\nContenido del archivo. termina con escape '\n\r"); 00030 do{ 00031 if(pc.readable()){ 00032 serial = pc.getc(); 00033 if(serial == 0x1B) terminante = 1; 00034 else datos[i++] = serial; 00035 } 00036 }while(!terminante); 00037 fprintf(fl, &datos[0]); 00038 fclose(fl); 00039 pc.printf("Listo"); 00040 }
Generated on Tue Jul 19 2022 03:32:38 by
1.7.2
