Code APP3

Dependencies:   mbed EthernetInterface WebSocketClient mbed-rtos BufferedSerial

Fork of APP3_Lab by Jean-Philippe Fournier

parser.cpp

Committer:
JayMcGee
Date:
2017-09-30
Revision:
4:ed53c87777f6
Parent:
3:a07b74f94890
Child:
5:9e6a09a38785

File content as of revision 4:ed53c87777f6:

#include "parser.h"

void ReadFile()
{
    Serial pc(USBTX, USBRX); // tx, rx
    FILE *fp = fopen("/config.txt", "r");  // Ouvrir config.txt pour lecture seulement
    if(fp == NULL)
    {
        pc.printf("Failed to find configuration file. \n\r");
    }
    else
    {
        pc.printf("Config file opened. \n\r");
        fscanf(fp,"%s",&PanID); // read PanId
        fscanf(fp,"%s",&URL); // read URL        
        pc.printf("PanId : %s\r\n",PanID); // Display PanId
        pc.printf("ServeurURL : %s\r\n",URL); // Display URL
        fclose(fp);
    }
}