PRO2_Team 1_collected code with ticker and headers_not working yet
Fork of PRO2_samlet_kode by
logging.cpp
- Committer:
- OlgaHoeyer
- Date:
- 2017-05-24
- Revision:
- 6:12f1849aad21
- Parent:
- 5:b366110c0d59
- Child:
- 8:ca39892f5423
File content as of revision 6:12f1849aad21:
/* ------------------------------------------------------------------------------- -- Project: PRO2 "Awareness and Optimisation of energy consumption" -- Team: Team 1 -- File Name: logging.cpp -- Author: Emil Hammer -- Date: 19/05-2017 -- Copyright: Open to all -- Version: 1.0 - Creation of file. -- -- Description: Logging data -- ------------------------------------------------------------------------------- */ #include "mbed.h" void logging () { int i,t; FILE *fp; if ((fp = fopen("Logger_data", "a+")) == NULL) { //filnavn logger_data fprintf (stdout, "Can't open \"Logger_data\" file.\n"); exit(EXIT_FAILURE);//sikre at filen kan åbnes } fprintf(fp,"\n\nlogger_data kl.00.00 D.dd-mm-yyyy\n"); //skriver i fil fprintf(fp,"Temperatur:x\n");//variable fra temp indsættes fprintf(fp,"Co2:x\n");//variable fra Co2 indsættes fprintf(fp,"H2o:x"); //variable fra H2o indsættes fprintf(fp,"Logger_data update complete!"); // if (fclose(fp) != 0) fprintf(stderr, "Error closing file\n"); //lukker fil //sætter i og t = 0 i=0; t=0; return; //går over i hibernation }