kh

Dependencies:   mbed PinDetect Servo

authentication.cpp

Committer:
Sayak97
Date:
10 months ago
Revision:
1:2c365f6da61d
Parent:
0:28e05e1a3d1e
Child:
2:04bbd14722bd

File content as of revision 1:2c365f6da61d:

/*
* Authors: Group 4 Adam Elghor, Brian Kaplan, Sayak Chatterjee, Moraa Onwonga
* Purpose: Controls Input and Output Data
* Language: C
*/
#include "authentication.h"
#include "powerManagement.h"
#include "parameters.h"

int p1;
int p2;
int p3;
int p4;

int entryNum1;
int entryNum2;
int entryNum3;
int entryNum4;


Serial blue(p28,p27);

AnalogIn pot1(p18);
AnalogIn pot2(p18);
AnalogIn pot3(p20);
AnalogIn pot4(p20);

/*
* 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;

	return (checkPot(p1,entryNum1) && checkPot(p2,entryNum2) && checkPot(p3,entryNum3) && checkPot(p3,entryNum3));
}

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() {

}