Louis REYNIER / Mbed 2 deprecated LectureFichierLocal

Dependencies:   mbed

Fork of LocalFileSystem_HelloWorld by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 Serial pc(USBTX, USBRX); // tx, rx
00003 LocalFileSystem local("local");               // Create the local filesystem under the name "local"
00004 DigitalOut myled1(LED1);
00005 DigitalOut myled2(LED2);
00006 
00007 int main() {
00008     int tablo[6] = {0};
00009     int i = 0;
00010     myled1 = 1 ;
00011     myled1 = 0 ;
00012     printf("Debut programme \n");
00013     printf("Lecture des donnees \n");
00014     FILE *fp = fopen("/local/compil.txt", "r");  // Open "out.txt" on the local file system for writing
00015     for (i =0; i<6; i++)
00016     {
00017     fscanf(fp, "%d \n", &tablo[i]);
00018     }
00019     fclose(fp);
00020     // sortie sur moniteur
00021     printf("Donnees lues \n");
00022     myled1 = 0 ;
00023     for (i =0; i<6; i++)
00024     {
00025     printf("tablo[%d] = %d \n", i, tablo[i]);
00026     } 
00027     printf("Fin programme \n");
00028     myled2 = 1 ;
00029     
00030 }