kh

Dependencies:   mbed PinDetect Servo

Revision:
0:28e05e1a3d1e
Child:
1:2c365f6da61d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Nov 10 19:30:54 2018 +0000
@@ -0,0 +1,47 @@
+/*
+* Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga
+* Purpose: Controls the functions of the safe
+* Language: C
+*/
+#include "open.h"
+#include "lock.h"
+#include "setup.h"
+#include "sleep.h"
+#include "parameters.h"
+
+task main() {
+    SafeStateMachine();
+}
+
+/*
+* Function:  SafeStateMachine
+* --------------------
+*  Routine for the safe's basic functions.
+*
+*
+*
+*/
+void SafeStateMachine() {
+
+
+    enum states state = SETUP;
+
+    while (1) {
+        switch (state) {
+        case OPEN:/*state in which the the case is open*/
+            state = open();
+            break;
+        case LOCK:/*state in which the case us closed*/
+            state = lock();
+            break;
+        case SETUP:/*state in which the the case is changing its settings*/
+            state = setup();
+            break;
+        default:
+            state = locked();
+        }
+    }
+}
+
+
+