PRO2_Team 1_collected code with ticker and headers_not working yet

Dependencies:   SHTx mbed

Fork of PRO2_samlet_kode by Olga Høyer

logging.cpp

Committer:
OlgaHoeyer
Date:
2017-06-20
Revision:
11:3ff48fb0aa0b
Parent:
8:ca39892f5423

File content as of revision 11:3ff48fb0aa0b:

/*
-------------------------------------------------------------------------------
-- 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"
#include "settings.cpp"

void logging ()
{
    extern int Set_temp
    int i;
    int t;
    FILE *fp;


    if ((fp = fopen("Logger_data", "a+")) == NULL) { //filname logger_data
        fprintf (stdout, "Can't open \"Logger_data\" file.\n");
        exit(EXIT_FAILURE);
    }

    fprintf(fp,"\n\nlogger_data kl.00.00 D.dd-mm-yyyy\n"); //writes to file
    fprintf(fp,"Temperatur: %s \n",set_temp);//variable from settings
    fprintf(fp,"Temperatur_low: &s\n", temperatur:_low);
    fprintf(fp,"Temperatur_high: %s \n",hemperatur:_high);
    fprintf(fp,"Humid: %s",humidity); //variable from sensor


    fprintf(fp,"Logger_data update complete!");
    if (fclose(fp) != 0)
        fprintf(stderr, "Error closing file\n"); //closing file

    // i and t = 0
    i=0;
    t=0;

    return; //going to hibernation
}