Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of LocalFileSystem_Read by
localRead.cpp
- Committer:
- cashdollar
- Date:
- 2015-07-01
- Revision:
- 2:67fab81637b1
- Parent:
- 1:a5555eb914bb
File content as of revision 2:67fab81637b1:
#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
}
