Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Servo PinDetect
lock.cpp
00001 /* 00002 * Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga 00003 * Purpose: Controls the LOCK state of the machine 00004 * Language: C++ 00005 */ 00006 #include "lock.h" 00007 #include "authentication.h" 00008 #include "actuators.h" 00009 #include "parameters.h" 00010 00011 /* 00012 * Function: lock 00013 * -------------------- 00014 * Locks safe 00015 * 00016 * returns: the next state in the state machine 00017 * Open: After it has been locked 00018 * 00019 */ 00020 enum states lock() { 00021 if(authenticateLock()) { 00022 openSafe(); 00023 wait(5); 00024 return OPEN; 00025 } else { 00026 return LOCK; 00027 } 00028 } 00029 00030 /* 00031 * Function: authenticateLock 00032 * ---------------------------- 00033 * Checks whether a cup was found through the sonar sensor 00034 * 00035 * returns: true if cup found else false 00036 */ 00037 bool authenticateLock() { 00038 return CorrectEntrySequenceAttempt(); 00039 } 00040
Generated on Thu Jul 14 2022 04:06:30 by
1.7.2