kh

Dependencies:   mbed PinDetect Servo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002 * Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga
00003 * Purpose: Controls the functions of the safe
00004 * Language: C
00005 */
00006 #include "open.h"
00007 #include "lock.h"
00008 #include "setup.h"
00009 #include "parameters.h"
00010 #include "authentication.h"
00011 
00012 
00013 
00014 enum states state = SETUP;
00015 
00016 /*
00017 * Function:  SafeStateMachine
00018 * --------------------
00019 *  Routine for the safe's basic functions.
00020 *
00021 *
00022 *
00023 */
00024 void SafeStateMachine()
00025 {
00026     while (1) {
00027         switch (state) {
00028         case OPEN:/*state in which the the case is open*/
00029             state = open();
00030             break;
00031         case LOCK:/*state in which the case us closed*/
00032             state = lock();
00033             break;
00034         case SETUP:/*state in which the the case is changing its settings*/
00035             state = setup();
00036             break;
00037         default:
00038             state = lock();
00039         }
00040         wait(.5);
00041         
00042     }
00043 }
00044 
00045 int main() {
00046     start_bluetooth();
00047     SafeStateMachine();
00048 }
00049 
00050 
00051 
00052