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@61:e7f2a0e38360, 2015-08-04 (annotated)
- Committer:
- aidanPJG
- Date:
- Tue Aug 04 10:24:39 2015 +0000
- Revision:
- 61:e7f2a0e38360
- Parent:
- 57:f94834892570
- Child:
- 64:809bd19f4e7c
average speed (total time) working now
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ADAMSTRUTT | 35:085a674c9fdf | 1 | #include "mbed.h" |
| ADAMSTRUTT | 35:085a674c9fdf | 2 | |
| ADAMSTRUTT | 35:085a674c9fdf | 3 | LocalFileSystem local("local"); |
| ADAMSTRUTT | 35:085a674c9fdf | 4 | |
| aidanPJG | 55:58e9836f5ad1 | 5 | void initialise(int counter ) |
| aidanPJG | 43:8e154016dd89 | 6 | { |
| aidanPJG | 43:8e154016dd89 | 7 | FILE *fp1 = fopen("/local/Datalog.xls", "a"); // opens or creates fill Datalog, and gives the headings |
| aidanPJG | 51:210353276e06 | 8 | fprintf(fp1, " Test %d \n", counter); |
| aidanPJG | 52:d21fc7266b66 | 9 | fprintf(fp1, " Sensor \t Time \t Speed \n"); |
| aidanPJG | 43:8e154016dd89 | 10 | fclose(fp1); |
| aidanPJG | 43:8e154016dd89 | 11 | } |
| aidanPJG | 43:8e154016dd89 | 12 | |
| aidanPJG | 57:f94834892570 | 13 | void data(int sensor_number, double time, double speed) |
| aidanPJG | 43:8e154016dd89 | 14 | { |
| aidanPJG | 61:e7f2a0e38360 | 15 | // printf("it be printing"); //testing |
| aidanPJG | 43:8e154016dd89 | 16 | FILE *fp = fopen("/local/Datalog.xls", "a"); // Open "Datalog |
| aidanPJG | 57:f94834892570 | 17 | fprintf(fp, " %d \t %lf \t %lf \n",sensor_number, time, speed); //fills the tables with the results |
| ADAMSTRUTT | 35:085a674c9fdf | 18 | fclose(fp); |
| aidanPJG | 45:eb06f1d42938 | 19 | } |
| aidanPJG | 45:eb06f1d42938 | 20 | |
| aidanPJG | 45:eb06f1d42938 | 21 | void averageData() //adds average data fom b2 to b6 |
| aidanPJG | 45:eb06f1d42938 | 22 | { |
| aidanPJG | 45:eb06f1d42938 | 23 | FILE *fp2 = fopen("/local/Datalog.xls", "a"); |
| aidanPJG | 47:1dc3b5f7bf4a | 24 | fprintf(fp2, " Average \t=SUM(B2:B4) / 5 \n"); |
| aidanPJG | 45:eb06f1d42938 | 25 | fclose(fp2); |
| ADAMSTRUTT | 35:085a674c9fdf | 26 | } |