Corrected header file include guards (did not encapsulate entire header).

Fork of LocalFileSystem_Read by HEL's Angels

Committer:
cashdollar
Date:
Tue Jun 30 05:04:36 2015 +0000
Revision:
1:a5555eb914bb
Child:
2:67fab81637b1
Updated to accommodate variable name requirements.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cashdollar 1:a5555eb914bb 1 #include "mbed.h"
cashdollar 1:a5555eb914bb 2 #include "initExoVars.h"
cashdollar 1:a5555eb914bb 3
cashdollar 1:a5555eb914bb 4
cashdollar 1:a5555eb914bb 5 //Serial pc(USBTX, USBRX); // tx, rx
cashdollar 1:a5555eb914bb 6 DigitalOut myled(LED4);
cashdollar 1:a5555eb914bb 7
cashdollar 1:a5555eb914bb 8 float RightCalib;//=1.123456; // gemeten waarde bij 4mA ( 0..1 <> 0..3.3v )
cashdollar 1:a5555eb914bb 9 float LeftCalib;//=1.123; // gemeten waarde bij 4mA ( 0..1 <> 0..3.3v )
cashdollar 1:a5555eb914bb 10 char A[10];//, B[10];
cashdollar 1:a5555eb914bb 11
cashdollar 1:a5555eb914bb 12 //MAYBE PUT THIS IN INIT
cashdollar 1:a5555eb914bb 13 LocalFileSystem local("local"); // Create the local filesystem under the name "local"
cashdollar 1:a5555eb914bb 14 //float leftOff;
cashdollar 1:a5555eb914bb 15
cashdollar 1:a5555eb914bb 16
cashdollar 1:a5555eb914bb 17
cashdollar 1:a5555eb914bb 18 void ReadFile (void)
cashdollar 1:a5555eb914bb 19 {
cashdollar 1:a5555eb914bb 20 FILE *set = fopen("/local/calib.txt", "r"); // Open "setup.txt" on the local file system for read
cashdollar 1:a5555eb914bb 21 fscanf(set,"%s %f",A,&LeftCalib); // read offset
cashdollar 1:a5555eb914bb 22 fscanf(set,"%s %f",A,&RightCalib); // read offset
cashdollar 1:a5555eb914bb 23 fclose(set);
cashdollar 1:a5555eb914bb 24 }
cashdollar 1:a5555eb914bb 25 /*
cashdollar 1:a5555eb914bb 26 void WriteFile(void) // write to USB memory
cashdollar 1:a5555eb914bb 27 {
cashdollar 1:a5555eb914bb 28 FILE *fp = fopen("/local/calib.txt", "w"); // Open "setup.txt" on the local file system for write
cashdollar 1:a5555eb914bb 29 fprintf(fp,"LeftCalib %f\r\n",Left); // read offset
cashdollar 1:a5555eb914bb 30 fprintf(fp,"RightCalib %f\r\n",Right); // read offset
cashdollar 1:a5555eb914bb 31 //fprintf(fp,"gain %f\r\n",lOffset); // read gain
cashdollar 1:a5555eb914bb 32 fclose(fp);
cashdollar 1:a5555eb914bb 33 }*/
cashdollar 1:a5555eb914bb 34
cashdollar 1:a5555eb914bb 35 void localRead()
cashdollar 1:a5555eb914bb 36 {
cashdollar 1:a5555eb914bb 37 //char A[10];
cashdollar 1:a5555eb914bb 38 myled=1;
cashdollar 1:a5555eb914bb 39 __disable_irq(); // Disable Interrupts
cashdollar 1:a5555eb914bb 40 wait(1);
cashdollar 1:a5555eb914bb 41 ReadFile();// when you run first time without this line, the setup file is on created
cashdollar 1:a5555eb914bb 42 wait(1);
cashdollar 1:a5555eb914bb 43 pc.printf("Calibration settings loaded. \r\nLeft Offset is: %f, Right Offset is: %f\r\n", LeftCalib, RightCalib);
cashdollar 1:a5555eb914bb 44 //pc.printf("%f\n roffset", roff);
cashdollar 1:a5555eb914bb 45 __enable_irq(); // Disable Interrupts
cashdollar 1:a5555eb914bb 46 }