ultrasonic distance sensor - time headerfile
Dependencies: N5110 PowerControl SRF02 beep mbed
Fork of Ultrasonicdistancesensor by
datafile.h@2:184524f95eb1, 2015-05-07 (annotated)
- Committer:
- probrania7
- Date:
- Thu May 07 16:43:32 2015 +0000
- Revision:
- 2:184524f95eb1
- Child:
- 3:bbfabbbc4291
screen not refreshing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
probrania7 | 2:184524f95eb1 | 1 | |
probrania7 | 2:184524f95eb1 | 2 | LocalFileSystem local("local"); //create local file system |
probrania7 | 2:184524f95eb1 | 3 | void writeDataToFile(int data); |
probrania7 | 2:184524f95eb1 | 4 | |
probrania7 | 2:184524f95eb1 | 5 | void writeDataToFile(int data) |
probrania7 | 2:184524f95eb1 | 6 | { |
probrania7 | 2:184524f95eb1 | 7 | //leds = 15; //turn on leds for feedback |
probrania7 | 2:184524f95eb1 | 8 | FILE *fp = fopen("/local/log.csv", "a"); //open 'log.csv' for apending |
probrania7 | 2:184524f95eb1 | 9 | |
probrania7 | 2:184524f95eb1 | 10 | //if the file doesnt exist it is created, if it exists, data is apended to the end |
probrania7 | 2:184524f95eb1 | 11 | fprintf(fp, "%0.2f C\n",data); //print string to file |
probrania7 | 2:184524f95eb1 | 12 | |
probrania7 | 2:184524f95eb1 | 13 | fclose(fp); //close file |
probrania7 | 2:184524f95eb1 | 14 | |
probrania7 | 2:184524f95eb1 | 15 | //leds = 0; //turn off leds to signify file access has finished |
probrania7 | 2:184524f95eb1 | 16 | } |