kh

Dependencies:   mbed PinDetect Servo

Revision:
0:28e05e1a3d1e
Child:
1:2c365f6da61d
diff -r 000000000000 -r 28e05e1a3d1e authentication.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/authentication.cpp	Sat Nov 10 19:30:54 2018 +0000
@@ -0,0 +1,83 @@
+/*
+* Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga
+* Purpose: Controls Input and Output Data
+* Language: C
+*/
+#include "logging.h"
+#include "powerManagement.h"
+#include "parameters.h"
+
+int p1;
+int p2;
+int p3;
+int p4;
+
+int entryNum1;
+int entryNum2;
+int entryNum3;
+int entryNum4;
+
+/*
+* Function: setEntrySequence
+* --------------------
+*  Reads in user's entry sequence attempt
+*/
+void setEntrySequenceAttempt() {
+	entryNum1 = float(pot1) * 10;
+	entryNum2 = float(pot2) * 10;
+	entryNum3 = float(pot3) * 10;
+	entryNum4 = float(pot4) * 10;
+}
+
+/*
+* Function:  CorrectEntrySequenceAttempt
+* --------------------
+*  Checks whether the user's entry sequence attempt is correct
+*
+*  returns: true if the entry sequence attempt from the user matches
+*  the set entry sequence otherwise false
+*
+*/
+bool CorrectEntrySequenceAttempt() {
+	p1 = float(pot1) * 10;
+	p2 = float(pot2) * 10;
+	p3 = float(pot3) * 10;
+	p4 = float(pot4) * 10;
+
+	if(checkPot(p1,entryNum1) && checkPot(p2,entryNum2) && checkPot(p3,entryNum3) && checkPot(p3,entryNum3) ){
+		return true;
+	}
+}
+
+bool checkPot(int p1, int p2) {
+	return (p2 - p1) < 2 && (p1 - p2) > -2;
+
+}
+
+
+
+/*
+* Function:  bluetooth
+* --------------------
+*  bluetooth stuff EDIT LATER
+*
+*  returns:
+*
+*/
+void bluetooth() {
+
+}
+
+
+/*
+* Function:  sdCard
+* --------------------
+*  sdCard stuff EDIT LATER
+*
+*  returns:
+*
+*/
+void sdCard() {
+
+}
+