kh
Dependencies: mbed PinDetect Servo
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 "powerManagement.h" 00010 #include "parameters.h" 00011 00012 /* 00013 * Function: lock 00014 * -------------------- 00015 * Locks safe 00016 * 00017 * returns: the next state in the state machine 00018 * Open: After it has been locked 00019 * 00020 */ 00021 enum states lock() { 00022 if(authenticateLock()) { 00023 openSafe(); 00024 wait(5); 00025 return OPEN; 00026 } else { 00027 return LOCK; 00028 } 00029 } 00030 00031 /* 00032 * Function: authenticate 00033 * ---------------------------- 00034 * Checks whether a cup was found through the sonar sensor 00035 * 00036 * returns: true if cup found else false 00037 */ 00038 bool authenticateLock() { 00039 return CorrectEntrySequenceAttempt(); 00040 } 00041
Generated on Wed Jul 13 2022 11:24:16 by 1.7.2