runinig version

Dependencies:   C12832_lcd NetServices freezer_guard_running mbed

Fork of Freezer_Guard_prog by team moped

Files at this revision

API Documentation at this revision

Comitter:
fbitz
Date:
Thu Jun 11 08:54:46 2015 +0000
Child:
1:356f5c46585f
Commit message:
running version;

Changed in this revision

C12832_lcd.lib Show annotated file Show diff for this revision Revisions of this file
NetServices.lib Show annotated file Show diff for this revision Revisions of this file
freezer_guard.lib 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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/C12832_lcd.lib	Thu Jun 11 08:54:46 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/dreschpe/code/C12832_lcd/#468cdccff7af
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NetServices.lib	Thu Jun 11 08:54:46 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/segundo/code/NetServices/#d64fca63b94e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/freezer_guard.lib	Thu Jun 11 08:54:46 2015 +0000
@@ -0,0 +1,1 @@
+freezer_guard#550514ed381f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jun 11 08:54:46 2015 +0000
@@ -0,0 +1,96 @@
+/*
+TODO:
+* Display entmüllen
+* Displayausgabefunktion anpassen (übergabe von koordinaten)
+* Emailfunktion anpassen (Text und Werte einsetzen)
+# wait anweisungen überprüfen und wenn möglich eliminieren
+# Datentypen reduzieren
+# Ungarische Notation einführen  (->  Coding Richtline)
+# bei printfunktionen string direkt übergeben
+#Doku
+#Demo VErsion mit Alarm bei >temp erstellen
+# DEBUG ausgaben entfernen
+*/
+
+
+/******************************************************
+*File Name: Freezer_Guard main.cpp
+*Purpose: Freezer Guard System protects your freezer from unintentionaly defrost
+*
+*Author: denis schnier and fabian bitz @ University of applied sciences bingen
+*Changes:
+*
+* 18.05.2015 initial version
+* ...
+*******************************************************/
+
+/******************************************************
+*1 Initialisierungsfunktion aufrufen
+*2 
+*3 readValue() aufrufen
+*3 Rueckgabewert pruefen
+    *3a Zustandsautomat auf Alarm oder zurück setzen 
+*4 ggf. sendMail() aufrufen
+    *4a sendMail initialisiert Ethertnet IF
+    *4b sendMail versendet email (alle ausgabe über serielle Konsole) 
+*5 audioAlarm() aufrufen und Alarmsound ausgeben 
+*6 springe zu *3   
+*******************************************************/
+#include "guard.h"
+#include "string.h"
+#define LIMIT -10   // Temperature Alarm Threshold
+byte bState;
+byte bError;
+char cString[25];
+char data_array[2];
+
+
+int main()
+{
+    int i8Value=0;
+    bState=0; //statemachine: 0=no Alarm, 1=Alarm and no Mail sent, 2=Alarm and Mail sent
+    bError=0;
+    vGuardInit(); 
+    
+    while(1){
+    i8Value=readValue(MCP9808_ADDR);
+    wait(1);
+    if(i8Value>LIMIT && bState==0) bState=1;
+    if(i8Value<LIMIT) bState=0;
+    switch(bState) {
+    case 0: { //normal case
+        vLcdIntPrint(i8Value);
+         break;
+         }
+         
+    case 1:{
+        vLcdIntPrint(i8Value);
+        strcpy(cString,"Alarm!");
+        vLcdStringPrint(cString);        
+        bError=SendMail(i8Value);
+        vAudioAlarm();
+        bState=2;
+          break;
+          }
+    case 2:{
+         vLcdIntPrint(i8Value);
+          strcpy(cString,"Mail Sent!");
+         vLcdStringPrint(cString);
+         vAudioAlarm();
+          break;
+            }
+    case 3:{                            //bState=3 could only be set by ISR
+         vLcdIntPrint(i8Value);
+         strcpy(cString,"Alarm Confirmed");
+         vLcdStringPrint(cString);
+         break;
+            }        
+    default:{
+           strcpy(cString,"State Machine Error!");
+          vLcdStringPrint(cString);
+          break;
+          }
+        }//state machine
+    }//while(1)
+
+}//main
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jun 11 08:54:46 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/e2ac27c8e93e