Lecture d'un fichier pour récupération données
Fork of LocalFileSystem_HelloWorld by
Revision 1:a5ed2347a210, committed 2017-06-22
- Comitter:
- LouisReynier
- Date:
- Thu Jun 22 13:05:32 2017 +0000
- Parent:
- 0:cc465aef98cf
- Commit message:
- Lecture fichier local pour recuperation donn?es sauvegard?es
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r cc465aef98cf -r a5ed2347a210 main.cpp --- a/main.cpp Wed Feb 13 16:36:26 2013 +0000 +++ b/main.cpp Thu Jun 22 13:05:32 2017 +0000 @@ -1,9 +1,30 @@ #include "mbed.h" - +Serial pc(USBTX, USBRX); // tx, rx LocalFileSystem local("local"); // Create the local filesystem under the name "local" - +DigitalOut myled1(LED1); +DigitalOut myled2(LED2); + int main() { - FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing - fprintf(fp, "Hello World!"); + int tablo[6] = {0}; + int i = 0; + myled1 = 1 ; + myled1 = 0 ; + printf("Debut programme \n"); + printf("Lecture des donnees \n"); + FILE *fp = fopen("/local/compil.txt", "r"); // Open "out.txt" on the local file system for writing + for (i =0; i<6; i++) + { + fscanf(fp, "%d \n", &tablo[i]); + } fclose(fp); + // sortie sur moniteur + printf("Donnees lues \n"); + myled1 = 0 ; + for (i =0; i<6; i++) + { + printf("tablo[%d] = %d \n", i, tablo[i]); + } + printf("Fin programme \n"); + myled2 = 1 ; + } \ No newline at end of file