Corrected header file include guards (did not encapsulate entire header).
Fork of LocalFileSystem_Read by
localRead.cpp
- Committer:
- nathanhonka
- Date:
- 2015-07-02
- Revision:
- 3:bf1ad768a7b3
- Parent:
- 2:67fab81637b1
File content as of revision 3:bf1ad768a7b3:
#include "mbed.h"
#include "initExoVars.h"
//Serial pc(USBTX, USBRX); // tx, rx
DigitalOut myled(LED4);
float RightCalib;//=1.123456; // gemeten waarde bij 4mA ( 0..1 <> 0..3.3v )
float LeftCalib;//=1.123; // gemeten waarde bij 4mA ( 0..1 <> 0..3.3v )
char A[10];//, B[10];
//MAYBE PUT THIS IN INIT
LocalFileSystem local("local"); // Create the local filesystem under the name "local"
void ReadFile (void)
{
FILE *set = fopen("/local/calib.txt", "r"); // Open "setup.txt" on the local file system for read
fscanf(set,"%s %f",A,&LeftCalib); // read offset
fscanf(set,"%s %f",A,&RightCalib); // read offset
fclose(set);
}
/*
void WriteFile(void) // write to USB memory
{
FILE *fp = fopen("/local/calib.txt", "w"); // Open "setup.txt" on the local file system for write
fprintf(fp,"LeftCalib %f\r\n",Left); // read offset
fprintf(fp,"RightCalib %f\r\n",Right); // read offset
//fprintf(fp,"gain %f\r\n",lOffset); // read gain
fclose(fp);
}*/
void localRead()
{
//char A[10];
//myled=1;
__disable_irq(); // Disable Interrupts
ReadFile();// when you run first time without this line, the setup file is on created
pc.printf("Calibration settings loaded. \r\nLeft Offset is: %f, Right Offset is: %f\r\n", LeftCalib, RightCalib);
//pc.printf("%f\n roffset", roff);
__enable_irq(); // Disable Interrupts
}
