PRO2_Team 1_collected code with ticker_not working yet

Dependencies:   SHTx mbed

Fork of PRO2_samlet_kode by Software hold - Team 1 - PRO2 2017

Files at this revision

API Documentation at this revision

Comitter:
OlgaHoeyer
Date:
Wed May 24 09:34:54 2017 +0000
Parent:
4:eb483906704a
Commit message:
included settings og logging, rettet tickers syntax, not working yet.

Changed in this revision

Settings.cpp Show annotated file Show diff for this revision Revisions of this file
Settings.h Show annotated file Show diff for this revision Revisions of this file
logging.cpp Show annotated file Show diff for this revision Revisions of this file
logging.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Settings.cpp	Wed May 24 09:34:54 2017 +0000
@@ -0,0 +1,45 @@
+//Author : Emil Hammer
+//Date : 19 May 2017
+//Version : 1.0
+//Copyright : Open for everyone
+//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;
+
+int main()
+{
+    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;
+        }
+    }
+
+    int temperature_low = (set_temp-5);
+    int temperature_high = (set_temp+5);
+    /* Temperature that defines what uncomfortable */
+
+
+    i=2;
+    t=700; //force the program to pass hibernation.
+    return 0;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Settings.h	Wed May 24 09:34:54 2017 +0000
@@ -0,0 +1,8 @@
+//Author : Emil Hammer
+//Date : 19 May 2017
+//Version : 1.0
+//Copyright : Open for everyone
+//Description : User input for temp.
+// Usage: Settings();
+
+void Settings();
\ No newline at end of file
--- a/logging.cpp	Fri May 19 11:24:58 2017 +0000
+++ b/logging.cpp	Wed May 24 09:34:54 2017 +0000
@@ -1,3 +1,9 @@
+//Author : Emil Hammer
+//Date : 19 May 2017
+//Version : 1.0
+//Copyright : Open for everyone
+//Description : Logging data
+
 #include "mbed.h"
 
 void logging ()
--- a/logging.h	Fri May 19 11:24:58 2017 +0000
+++ b/logging.h	Wed May 24 09:34:54 2017 +0000
@@ -1,3 +1,8 @@
-
+//Author : Emil Hammer
+//Date : 19 May 2017
+//Version : 1.0
+//Copyright : Open for everyone
+//Description : Logging data
+// Usage: logging();
 
 void logging ();
\ No newline at end of file
--- a/main.cpp	Fri May 19 11:24:58 2017 +0000
+++ b/main.cpp	Wed May 24 09:34:54 2017 +0000
@@ -5,6 +5,7 @@
 #include <compare.h>
 #include <data_out.h>
 #include <logging.h>
+#include <Settings.h>
 #include <rgb_led.h>
 #include <Ticker.h>
 
@@ -29,16 +30,18 @@
 
 int main()
 {
+        tick1.attach(&Settings(), 20);                    //Settings
+        tick2.attach(&GetTemperatureAndHumidity(),20);  //Data Collection
+        tick3.attach(&Compare_values(),20);             //Data Analysis
+        tick4.attach(&rgb_outp(),20);                   //RGB_LED_output
+    
     while(1) {
         logging ();
 
-        //tick1.atach(Settings(), 20);        //MISSING PROGRAM PART!!!!!!!
-
-        tick2.attach(GetTemperatureAndHumidity(),20);        //Data Collection
-
-        tick3.attach(Compare_values(humidity, temperature, temperature_low, temperature_high),20); //Data Analysis
-
-        tick4.attach(rgb_outp(Compare_values(humidity, temperature, temperature_low, temperature_high)),20);                  //RGB_LED_output
+        
+        //tick2.attach(&GetTemperatureAndHumidity(),20);        //Data Collection
+        //tick3.attach(&Compare_values(humidity, temperature, temperature_low, temperature_high),20); //Data Analysis
+        //tick4.attach(&rgb_outp(Compare_values(humidity, temperature, temperature_low, temperature_high)),20);  //RGB_LED_output
 
     }
 }