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

Revision:
4:628468ce3e86
Parent:
2:04bbd14722bd
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/lock.cpp	Sat Dec 29 07:04:53 2018 +0000
@@ -0,0 +1,40 @@
+/*
+* Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga
+* Purpose: Controls the LOCK state of the machine
+* Language: C++
+*/
+#include "lock.h"
+#include "authentication.h"
+#include "actuators.h"
+#include "parameters.h"
+
+/*
+* Function:  lock
+* --------------------
+*  Locks safe
+*
+*  returns: the next state in the state machine
+*  Open: After it has been locked
+*
+*/
+enum states lock() {
+	if(authenticateLock()) {
+		openSafe();
+		wait(5);
+		return OPEN;
+	} else {
+		return LOCK;
+	}
+}
+
+/*
+* Function: authenticateLock
+* ----------------------------
+*  Checks whether a cup was found through the sonar sensor
+*
+*  returns: true if cup found else false
+*/
+bool authenticateLock() {
+    return CorrectEntrySequenceAttempt();
+}
+