header file

Dependencies:   N5110 PowerControl SRF02 beep mbed

datafile.h

Committer:
probrania7
Date:
2015-05-11
Revision:
3:bbfabbbc4291
Parent:
2:184524f95eb1

File content as of revision 3:bbfabbbc4291:

/**
@file datafile.h
@function for writing files
*/

LocalFileSystem local("local"); //create local file system
void writeDataToFile(char* data1);

void writeDataToFile(char* data1)
{
    //leds = 15; //turn on leds for feedback
    FILE *fp = fopen("/local/log.csv", "a"); //open 'log.csv' for apending
    
    //if the file doesnt exist it is created, if it exists, data is apended to the end
    fprintf(fp, "%0.2f cm\n",data1); //print string to file
    //fprintf(fp, "%0.2f C\n",data2); //print string to file
    //fprintf(fp, "%0.2f C\n",data3); //print string to file
    
    fclose(fp); //close file
    
    //leds = 0; //turn off leds to signify file access has finished     
}