kh

Dependencies:   mbed PinDetect Servo

main.cpp

Committer:
Sayak97
Date:
2018-11-10
Revision:
1:2c365f6da61d
Parent:
0:28e05e1a3d1e
Child:
2:04bbd14722bd

File content as of revision 1:2c365f6da61d:

/*
* 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"


/*
* 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 = lock();
        }
    }
}

int main() {
    SafeStateMachine();
}