Safe of the God's was a group project. For the project we were given the task to create an electronic safe with an embedded system.
Dependencies: mbed Servo PinDetect
Diff: open.cpp
- Revision:
- 4:628468ce3e86
- Parent:
- 3:2f7a7e2cd49e
--- a/open.cpp Tue Nov 13 03:19:06 2018 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga -* Purpose: Controls the OPEN state of the machine -* Language: C -*/ -#include "open.h" -#include "authentication.h" -#include "actuators.h" -#include "parameters.h" - -/* -* Function: OPEN -* -------------------- -* Calls the functions needed to for the open state -* -* -* returns: the next state in the state machine -* LOCK: if closed properly -* ALARM: if cup is not found after searching in a full circle -* -*/ -enum states open() { - if (authenticateOpen()) { - return OPEN; - } else { - lockSafe(); - wait(5); - return LOCK; - } -} - -/* -* Function: authenticate -* ---------------------------- -* Checks whether a cup was found through the sonar sensor -* -* returns: true if cup found else false -*/ -bool authenticateOpen() { - return CorrectEntrySequenceAttempt(); -} - -