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.
Dependencies: mbed
Data.cpp
00001 #include "mbed.h" 00002 #include <string> 00003 00004 LocalFileSystem local("local"); 00005 extern Serial pc; 00006 00007 void initialise(int counter, string date ) 00008 { 00009 FILE *fp1 = fopen("/local/Datalog.xls", "a"); // opens or creates fill Datalog, 00010 fprintf(fp1, " Test %d \n %s \n", counter, date); //gives header 00011 fprintf(fp1, " Sensor \t Total Time \t Time Diff \t Inst Speed \t Avg Speed\n"); //writes field names 00012 fclose(fp1); //closes the file so it can be opened by another method 00013 } 00014 00015 void data(int sensor_number, double time, double speed, double timesTotal,double speedAvg) 00016 { 00017 FILE *fp = fopen("/local/Datalog.xls", "a"); // Open "Datalog 00018 fprintf(fp, " %d \t %lf \t %lf \t %lf \t %lf \n",sensor_number + 1, timesTotal ,time, speed, speedAvg); //fills the tables with the results. sensorNumber +1 because sensor starts at 0. 00019 fclose(fp); //close 00020 } 00021 00022 //*********This has not been done yet, but it would be nice to have an average speed for each bend******** 00023 void averageData() //adds average data fom b2 to b6 00024 { 00025 FILE *fp2 = fopen("/local/Datalog.xls", "a"); 00026 fprintf(fp2, " Average \t=SUM(B2:B4) / 5 \n"); 00027 fclose(fp2); 00028 }
Generated on Fri Jul 15 2022 03:23:27 by
1.7.2