Rancang Bangun Sistem Keamanan Loker Mengunakan Sistem Biometrik Sidik Jari

LAMPIRAN PROGRAM

a.

Library
#include
#include
#include
#include
#include

b. Inilisialisasi Variabel dan PORT
uint8_t getFingerprintEnroll(uint8_t id);
SoftwareSerial mySerial(52, 53);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
int addr = 0;
byte value;
uint8_t p = -1;
int addr_door1 = 0;
int addr_door2 = 1;
int


dot=0,n_code=3,id_door=0,door=0,g=0,x=0,i=0,

times=0,

times1=0,

times2=0;
char pass1[3] = {'0','0','0'};
char pass2[3] = {'0','0','0'};
int passA1=2;
int passA2=3;
int passA3=4;

51
Universitas Sumatera Utara

int passB1=5;
int passB2=6;
int passB3=7;

const byte ROWS = 4;
const byte COLS = 4;
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
char key[3] = {'0','0','0'};
char hexaKeys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {23, 25, 27, 29};
byte colPins[COLS] = {31, 33, 35, 37};
Keypad customKeypad = Keypad( makeKeymap(hexaKeys), rowPins,
colPins, ROWS, COLS);
c.

Configurasi Pin dan Conektifitas (void setup())
void setup() {
Serial.begin(9600);
lcd.begin(16, 2);

finger.begin(57600);
pinMode(50,OUTPUT);
pinMode(24,OUTPUT);
digitalWrite(50,LOW);
digitalWrite(24,LOW);

52
Universitas Sumatera Utara

if (finger.verifyPassword())
{
lcd.setCursor(0, 0);
Serial.println("Fingerprint");
}
else
{
lcd.setCursor(0, 0);
Serial.println("Not Found");
while (1);
}

}
c.1 Fungsi Tambahan (void Inputoin() dan void cdange_pass())
void InputPin()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("ups, not match");
delay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("PIN code ");
delay(1000);
while(times < 3)
{
char customKey = customKeypad.getKey();
if (customKey)
{
key[x]=customKey;
if(x < n_code)
53

Universitas Sumatera Utara

{
if(id_door==1)
{
pass1[0]=EEPROM.read(passA1);
pass1[1]=EEPROM.read(passA2);
pass1[2]=EEPROM.read(passA3);
if(key[x]==pass1[x])
{
times++;
lcd.setCursor(x, 1);
lcd.print(customKey);
delay(300);
x++;
continue;
}
else
{
lcd.setCursor(0, 0);

lcd.print("ups, not match");
delay(1000);
lcd.clear();
times = 0;
x=0;
return;
}
}
else if(id_door==2)
{
pass2[0]=EEPROM.read(passB1);
pass2[1]=EEPROM.read(passB2);
pass2[2]=EEPROM.read(passB3);
if(key[i]==pass2[i])

54
Universitas Sumatera Utara

{
times++;

lcd.setCursor(x, 1);
lcd.print(customKey);
delay(300);
x++;
continue;
}
else
{
lcd.setCursor(0, 0);
lcd.print("ups, not match");
delay(1000);
lcd.clear();
times = 0;
x=0;
return;
}
}
}
}
}

}
void change_pass()
{
g=0;
lcd.clear();
while(g