PRO2_Team 1_collected code with ticker and headers_not working yet

Dependencies:   SHTx mbed

Fork of PRO2_samlet_kode by Olga Høyer

Settings.cpp

Committer:
OlgaHoeyer
Date:
2017-06-20
Revision:
11:3ff48fb0aa0b
Parent:
9:de77a6f5ba43

File content as of revision 11:3ff48fb0aa0b:

/*
-------------------------------------------------------------------------------
-- Project:         PRO2 "Awareness and Optimisation of energy consumption"
-- Team:            Team 1

-- File Name:       Settings.cpp
-- Author:          Emil Hammer
-- Date:            19/05-2017
-- Copyright:       Open to all
-- Version:         1.0 - Creation of file.
--
-- Description:     Settings
--
-------------------------------------------------------------------------------
*/

#include "mbed.h"

DigitalOut myled(LED1);
DigitalIn up(p5);
DigitalIn down(p6);


extern int timespan;
int t;
int i, set_temp;
//int temperature_low,temperature_high;

void Settings(int *temperature_low, int *temperature_high)
{
    while(i<1) { //Open set_temp for user input.

        if (up==1) {//recieve input from user
            set_temp = (set_temp +1);
        } // when "up" tricked set_temp raise 1
        if (down==1) {
            set_temp = (set_temp -1);
        } // when "down" tricked set_temp raise 1
        else if (timespan == 500);
        {
            /* if 500 ms passes without a user input
             the program will break the loop*/
            break;
        }
    }

    *temperature_low = (set_temp-3);
    *temperature_high = (set_temp+3);
    /* Temperature that defines what uncomfortable */


    i=2;
    t=700; //force the program to pass hibernation.
    return 0;
}