Pipeline Technology Centre / Mbed 2 deprecated PTCSpeed_MBED1

Dependencies:   mbed mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Data.cpp Source File

Data.cpp

00001 #include "Data.h"
00002 #include "UserInput.h"
00003 #include "mbed.h"
00004 #include <string>
00005 
00006 extern LocalFileSystem local;
00007 UserInput userInput;
00008 
00009 //sets up the excel file inputing the
00010 void Data::initialise()
00011 { 
00012     FILE *fdata = fopen("/local/Datalog.xls", "w");
00013     fprintf(fdata, "Company\t%sPipename\t%s", userInput.company(), userInput.pipeName());
00014     fclose (fdata);
00015 }
00016 
00017 void Data::counter(int count)
00018 { 
00019     FILE *f1data = fopen("/local/Datalog.xls", "a");       
00020     fprintf(f1data, "Round %d of bending\nSensor number\tTime\tSpeed\n", count); 
00021     fclose(f1data);
00022 }
00023 
00024 void Data::logSpeed(int *sensor_number, float *time, float *speed)
00025 {
00026     FILE *f2data = fopen("/local/Datalog.xls", "a");
00027     fprintf(f2data, "%d\t %f\t %f \n", *sensor_number, *time, *speed);
00028     fclose(f2data);
00029 }