02/07/15

Dependencies:   mbed

Dependents:   TabbedGUIMbed

Data.cpp

Committer:
aidanPJG
Date:
2015-08-04
Revision:
61:e7f2a0e38360
Parent:
57:f94834892570
Child:
64:809bd19f4e7c

File content as of revision 61:e7f2a0e38360:

#include "mbed.h"

LocalFileSystem local("local"); 

void initialise(int counter )
{ 
    FILE *fp1 = fopen("/local/Datalog.xls", "a");       // opens or creates fill Datalog, and gives the headings
    fprintf(fp1, " Test %d \n", counter);
    fprintf(fp1, " Sensor \t Time \t Speed \n");
    fclose(fp1);
}

void data(int sensor_number, double time, double speed)
{
  //  printf("it be printing");                            //testing  
    FILE *fp = fopen("/local/Datalog.xls", "a");       // Open "Datalog
    fprintf(fp, " %d \t %lf \t %lf \n",sensor_number, time, speed);       //fills the tables with the results
    fclose(fp);
}
    
void averageData()                                        //adds average data fom b2 to b6
{ 
    FILE *fp2 = fopen("/local/Datalog.xls", "a");       
    fprintf(fp2, " Average \t=SUM(B2:B4) / 5 \n"); 
    fclose(fp2);
}