asd
Dependencies: SDFileSystem mbed
Fork of SDFileSystem_HelloWorld by
SD card write - fat file system kl46z
main.cpp@4:b77d7295fce4, 2017-08-24 (annotated)
- Committer:
- fblanc92
- Date:
- Thu Aug 24 00:24:00 2017 +0000
- Revision:
- 4:b77d7295fce4
- Parent:
- 3:b2658ae9fc38
- Child:
- 5:61647cd1e811
Version para agregar (append) un .txt
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 0:bdbd3d6fc5d5 | 1 | #include "mbed.h" |
mbed_official | 0:bdbd3d6fc5d5 | 2 | #include "SDFileSystem.h" |
fblanc92 | 3:b2658ae9fc38 | 3 | |
fblanc92 | 2:8a7953dfeccd | 4 | SDFileSystem sd(PTA16,PTA17,PTA15,PTA14, "sd"); // the pinout on the mbed Cool Components workshop board |
fblanc92 | 3:b2658ae9fc38 | 5 | |
fblanc92 | 2:8a7953dfeccd | 6 | int main() |
fblanc92 | 2:8a7953dfeccd | 7 | { |
fblanc92 | 4:b77d7295fce4 | 8 | mkdir("/sd/MiDirectorio2", 0777); //creacion directorio |
fblanc92 | 2:8a7953dfeccd | 9 | |
fblanc92 | 4:b77d7295fce4 | 10 | FILE *fp = fopen("/sd/MiDirectorio2/sdtest.txt", "a"); //puntero tipo file guarda directorio |
fblanc92 | 3:b2658ae9fc38 | 11 | /* if(fp == NULL) { |
fblanc92 | 3:b2658ae9fc38 | 12 | error("No se pudo abrir archivo para escritura\n"); |
fblanc92 | 3:b2658ae9fc38 | 13 | }; |
fblanc92 | 3:b2658ae9fc38 | 14 | */ |
fblanc92 | 4:b77d7295fce4 | 15 | fprintf(fp, "Hola Mundo - SD card"); //file print |
fblanc92 | 4:b77d7295fce4 | 16 | fprintf(fp,"\n"); |
fblanc92 | 4:b77d7295fce4 | 17 | fprintf(fp,"Kenedy Patricio"); |
fblanc92 | 4:b77d7295fce4 | 18 | fprintf(fp,"\n"); |
fblanc92 | 4:b77d7295fce4 | 19 | fprintf(fp,"Scilabra Martin"); |
fblanc92 | 4:b77d7295fce4 | 20 | fprintf(fp,"\n"); |
fblanc92 | 4:b77d7295fce4 | 21 | fprintf(fp,"Serafini Gerardo"); |
fblanc92 | 3:b2658ae9fc38 | 22 | fclose(fp); //cierra archivo |
fblanc92 | 3:b2658ae9fc38 | 23 | } |