kh
Dependencies: mbed PinDetect Servo
open.cpp
00001 /* 00002 * Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga 00003 * Purpose: Controls the OPEN state of the machine 00004 * Language: C 00005 */ 00006 #include "open.h" 00007 #include "authentication.h" 00008 #include "actuators.h" 00009 #include "parameters.h" 00010 00011 /* 00012 * Function: OPEN 00013 * -------------------- 00014 * Calls the functions needed to for the open state 00015 * 00016 * 00017 * returns: the next state in the state machine 00018 * LOCK: if closed properly 00019 * ALARM: if cup is not found after searching in a full circle 00020 * 00021 */ 00022 enum states open() { 00023 if (authenticateOpen()) { 00024 return OPEN; 00025 } else { 00026 lockSafe(); 00027 wait(5); 00028 return LOCK; 00029 } 00030 } 00031 00032 /* 00033 * Function: authenticate 00034 * ---------------------------- 00035 * Checks whether a cup was found through the sonar sensor 00036 * 00037 * returns: true if cup found else false 00038 */ 00039 bool authenticateOpen() { 00040 return CorrectEntrySequenceAttempt(); 00041 } 00042 00043
Generated on Wed Jul 13 2022 11:24:16 by 1.7.2