• Tidak ada hasil yang ditemukan

LAMPIRAN A LISTING KODE PROGRAM ARDUINO

N/A
N/A
Protected

Academic year: 2019

Membagikan "LAMPIRAN A LISTING KODE PROGRAM ARDUINO"

Copied!
26
0
0

Teks penuh

(1)

LAMPIRAN A

LISTING KODE PROGRAM

ARDUINO

#include <Adafruit_Fingerprint.h> #include <SoftwareSerial.h>

#include <EEPROM.h>

#include <SPI.h> //pustaka SPI #include <MFRC522.h> //pustaka MFRC522

/************************************************* KONFIGURASI & INISIALISASI RFID Reader MF522-AN ***************************************************/ #define SS 53

#define RST 42 /*

Konfigurasi pin ARDUINO MEGA 2560 ke MFRC522 BOARD

Reset 42 SS 53 MOSI 51 MISO 50 SCK 52 */

unsigned char uidskrg[7] = {0,0,0,0,0,0,0}; unsigned char uidbru[7] = {0,0,0,0,0,0,0}; int i;

MFRC522 mfrc522(SS, RST);

/************************************************* INISIALISASI EEPROM

**************************************************/ // UID and Image address start from 2

// For address 0 and 1 is used for the saving the last address

//Variable for accessing EEPROM //Address EEPROM start from 0 uint16_t addr = 0;

uint16_t val[] = {0};

uint8_t viDaddr; uint8_t temp[137];

uint8_t valFinger[137]; uint8_t verSign = 0;

uint16_t lastaddr = 0; uint16_t lbyte = 0; uint16_t hbyte = 0;

(2)

uint8_t MATSIG = 0; //Signal for REGISTRASI or VERIFIKASI button

uint8_t MATsig = 0; //Signal for Scan ID or Scan FP

/**************************************************************** KONFIGURASI & INISIALISASI RFID Reader MF522-AN dan Finger Print

Sensor(ZFM-20)

*****************************************************************/

// pin #10 is IN from sensor (GREEN wire) // pin #11 is OUT from arduino (WHITE wire) SoftwareSerial mySerial(10, 11);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup() {

Serial.begin(9600);

Serial.println("Serial COM enabled"); SPI.begin(); // Init SPI bus

mfrc522.PCD_Init(); // Init MFRC522 card

Serial.println("Found RFID sensor");

/************************************************* DETECT FINGER PRINT SENSOR (ZFM-20)

***************************************************/

// set the data rate for the sensor serial port finger.begin(57600);

if (finger.verifyPassword()) {

Serial.println("Found fingerprint sensor"); } else {

Serial.println("Did not find fingerprint sensor :("); //while (1);

}

Serial.println("~"); }

void loop() {

while(1) {

//Check the Last Address

hbyte = EEPROM.read(0); // read hy byte EEPROM lastaddr = hbyte;

lastaddr <<= 8;

lbyte = EEPROM.read(1); // read low byte EEPROM

//get complete last address lastaddr |= lbyte;

addr = lastaddr; if (addr >= 4089){

Serial.println("full capacity ! "); break;}

(3)

MATSIG = Serial.read();

switch (MATSIG) { //************ //REGISTRASI //************ case '^': {

while(MATsig != '!'){MATsig = Serial.read();} //Baca UID

{RegisterCard();}

while(MATsig != '@'){MATsig = Serial.read();} //Baca Citra Sidik Jari

{RegisterFinger();}

//Save last address lastaddr = addr;

lbyte = 0x00ff & lastaddr; //get low byte lastaddr >>= 8;

hbyte = 0x00ff & lastaddr; //get hi byte

EEPROM.write(0, hbyte); //save hi byte to address 0 EEPROM.write(1, lbyte); //save lo byte to address 1

} break;

//*********** //VERIFIKASI //*********** case '#':

{VerifyMember();} break;

default: break; }

} }

//************************* // FUNGSI REGISTER KARTU //************************* void RegisterCard()

{

while(1) {

// Look for new cards

if ( ! mfrc522.PICC_IsNewCardPresent()) {continue;}

// Select one of the cards

if ( ! mfrc522.PICC_ReadCardSerial()) {continue;}

for (byte i = 0; i < 7; i++) {

(4)

if (i >= 6)

{

for (byte i = 0; i < mfrc522.uid.size; i++) {

Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");

Serial.print(mfrc522.uid.uidByte[i],HEX); }

Serial.println();

for (byte i = 0; i < mfrc522.uid.size; i++) {uidskrg[i] = mfrc522.uid.uidByte[i];}

//******************** // SAVE UID to EEPROM //********************

for (byte i = 0; i < 7; i++) {

EEPROM.write(addr, uidskrg[i]); addr = addr + 1;

}

return; }

}

else if (uidskrg[i] == mfrc522.uid.uidByte[i]) {

if (i >= 6){continue;} }

else {

for (byte i = 0; i < mfrc522.uid.size; i++) {uidbru[i] = mfrc522.uid.uidByte[i];}

for (byte i = 0; i < mfrc522.uid.size; i++) {

Serial.print(uidbru[i] < 0x10 ? " 0" : " "); Serial.print(uidbru[i],HEX);

}

Serial.println();

for (byte i = 0; i < mfrc522.uid.size; i++) {uidskrg[i] = uidbru[i];}

//******************** // SAVE UID to EEPROM //********************

for (byte i = 0; i < 7; i++) {

EEPROM.write(addr, uidskrg[i]); addr = addr + 1;

}

return; } //else

}//for }//while(1)

(5)

//***************************** // REGISTER FINGER PRINT SENSOR //*****************************

void RegisterFinger() { uint8_t p = -1;

int i;

Serial.println("Waiting for valid finger to enroll"); delay(100);

while (p != FINGERPRINT_OK) { p = finger.getImage(); switch (p) {

case FINGERPRINT_OK:

//0x00 finger collection success

Serial.println("Image taken"); delay(500);

break;

case FINGERPRINT_NOFINGER: //0x02 can not detect finger

Serial.println("Place the finger..."); break;

case FINGERPRINT_PACKETRECIEVEERR: //0x01 error when receiving package

Serial.println("Communication error"); delay(100);

break;

case FINGERPRINT_IMAGEFAIL: //0x03 fail to collect finger

Serial.println("Imaging error"); delay(100);

break; default:

Serial.println("Unknown error"); //unknown error

delay(100); break; }

}

byte status; byte buffer[4];

p = finger.UpImage(); switch (p) {

case FINGERPRINT_OK: {

for (int i = 0; i < 137; i++) temp[i] = (mySerial.read());

valFinger[i] = temp[i]; }

(6)

//*******************************

Serial.println("Saving 80 byte to EEPROM..."); for (int i = 9; i < 89; i++)

{

EEPROM.write(addr, temp[i]); addr = addr + 1;

}

//******************************* // SAVE 48byte to EEPROM kartu //*******************************

Serial.println("Saving 48 byte to EEPROM Card..."); byte status,i = 89;

byte buffer[4];

// Tulis memori Mifare UL setiap 4 byte (per 1 page) see datasheet Mifare UL 3.6.7

for (byte page = 4; page < 16; page++) {

// Read returns data for 1 page at a time. // Write data

for (byte offset = 0; offset < 4; offset++) {

Serial.println(valFinger[i]);

buffer [offset] = valFinger[i];

status = mfrc522.MIFARE_Ultralight_Write(page, buffer, 4); i++;

} }

}// exit case(!)

delay(500); break;

default:

Serial.println("Unknown error"); delay(500);

break;

}//exit switch

Serial.println("~"); //sign to finish get image

}// void RegisterCard()

//************************* // FUNGSI VERIFIKASI KARTU //************************* void VerifyMember()

{

while(1) {

// Look for new cards

if ( ! mfrc522.PICC_IsNewCardPresent()) {continue;}

// Select one of the cards

if ( ! mfrc522.PICC_ReadCardSerial()) {continue;}

(7)

if (uidskrg[i] == 0) {

if (i >= 6)

{

for (byte i = 0; i < mfrc522.uid.size; i++) {

Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");

Serial.print(mfrc522.uid.uidByte[i],HEX); }

Serial.println();

for (byte i = 0; i < mfrc522.uid.size; i++) {uidskrg[i] = mfrc522.uid.uidByte[i];}

continue; }

else if (uidskrg[i] == mfrc522.uid.uidByte[i]) {

if (i >= 6){continue;} }

else {

for (byte i = 0; i < mfrc522.uid.size; i++) {uidbru[i] = mfrc522.uid.uidByte[i];}

for (byte i = 0; i < mfrc522.uid.size; i++) {

Serial.print(uidbru[i] < 0x10 ? " 0" : " "); Serial.print(uidbru[i],HEX);

}

Serial.println();

for (byte i = 0; i < mfrc522.uid.size; i++) {uidskrg[i] = uidbru[i];}

continue;

} //else }//for }//while(1)

}//void VerifyMember

MATLAB

function varargout = GUIVerSys(varargin)

% GUIVERSYS MATLAB code for GUIVerSys.fig

% GUIVERSYS, by itself, creates a new GUIVERSYS or raises the existing

% singleton*. %

% H = GUIVERSYS returns the handle to a new GUIVERSYS or the handle to

% the existing singleton*. %

% GUIVERSYS('CALLBACK',hObject,eventData,handles,...) calls the local

(8)

%

% GUIVERSYS('Property','Value',...) creates a new GUIVERSYS or raises the

% existing singleton*. Starting from the left, property value pairs are

% applied to the GUI before GUIVerSys_OpeningFcn gets called. An

% unrecognized property name or invalid value makes property application

% stop. All inputs are passed to GUIVerSys_OpeningFcn via varargin.

%

% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one

% instance to run (singleton)". %

% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help GUIVerSys % Last Modified by GUIDE v2.5 11-Feb-2015 08:08:52

% Begin initialization code - DO NOT EDIT

gui_Singleton = 1;

gui_State = struct('gui_Name', mfilename, ...

'gui_Singleton', gui_Singleton, ...

'gui_OpeningFcn', @GUIVerSys_OpeningFcn, ...

'gui_OutputFcn', @GUIVerSys_OutputFcn, ...

'gui_LayoutFcn', [] , ...

'gui_Callback', []);

if nargin && ischar(varargin{1})

gui_State.gui_Callback = str2func(varargin{1}); end

if nargout

[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); else

gui_mainfcn(gui_State, varargin{:}); end

% End initialization code - DO NOT EDIT

% --- Executes just before GUIVerSys is made visible.

function GUIVerSys_OpeningFcn(hObject, eventdata, handles, varargin)

% This function has no output args, see OutputFcn. % hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) % varargin command line arguments to GUIVerSys (see VARARGIN) % Choose default command line output for GUIVerSys

handles.output = hObject;

% Update handles structure

(9)

% UIWAIT makes GUIVerSys wait for user response (see UIRESUME) % uiwait(handles.figure1);

% --- Outputs from this function are returned to the command line.

function varargout = GUIVerSys_OutputFcn(hObject, eventdata, handles)

% varargout cell array for returning output args (see VARARGOUT); % hObject handle to figure

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) % Get default command line output from handles structure

varargout{1} = handles.output;

set(handles.txtMSG,'Visible','on');

checkxls = xls_check_if_open('Daftar_Anggota.xlsx');

if checkxls ~= 0 % jika xlsx terbuka

errormsg = 'file excel is opening, close it first'; waitfor(msgbox(errormsg,'Error'));

checkxls = xls_check_if_open('Daftar_Anggota.xlsx'); if checkxls ~= 0

xls_check_if_open('Daftar_Anggota.xlsx','close'); % tutup xlsx

end end

global s;

s = serial('com11','timeout',1);

fopen(s); i = 0; n = 0;

while i <= 4

i = i+1; n = fscanf(s)

pause(.1); n = strtrim(n);

set(handles.txtMSG,'String', n);

if (i==4)

sz = size(n); if (sz <= 1)

if (n == '~') break

else

if(ischar(n) == 0 || isempty(n)==1)

set(handles.txtMSG,'String', 'Serial data

error, unplug and plug or reprogram Arduino');

(10)

end else

set(handles.txtMSG,'String', 'Serial data error,

unplug and plug or reprogram Arduino');

break; end end end

set(handles.txtMSG,'String', 'Choose Register or Verify...');

% --- Executes on button press in Registrasi.

function Registrasi_Callback(hObject, eventdata, handles)

% hObject handle to Registrasi (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global s;

status = s.Status; if status(1,4) == 's'

newstatus = char(zeros(1,4)); for i=1:4

newstatus(1,i)= status(1,i); end

status = newstatus; end

if (status == 'open') pause(.01);

else fopen(s); i = 0; n = 0;

while i <= 4

i = i+1; n = fscanf(s)

pause(.1); n = strtrim(n);

set(handles.txtMSG,'String', n);

if (i==4)

sz = size(n); if (sz <= 1)

if (n == '~') break

else

if(ischar(n) == 0 || isempty(n)==1)

set(handles.txtMSG,'String', 'Serial data

error, unplug and plug or reprogram Arduino');

(11)

set(handles.txtMSG,'String', 'Serial data error,

unplug and plug or reprogram Arduino');

break; end end end end

set(handles.txtMSG,'String', 'Please, fill member identity'); set(handles.uipanel5,'Visible','off');

set(handles.uipanel1,'Visible','on');

pause(.1);

fwrite(s,'^'); %send REGISTRASI command pause(.1);

% --- Executes during object creation, after setting all properties.

function Registrasi_CreateFcn(hObject, eventdata, handles)

% hObject handle to Registrasi (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes on button press in btn_scanID.

function btn_scanID_Callback(hObject, eventdata, handles)

% hObject handle to btn_scanID (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global s;

set(handles.txtMSG,'String','Register ID Card'); pause(1);

set(handles.txtMSG,'String','Start scanning card...');

pause(.1); fwrite(s,'!'); pause(.1);

while 1

if (s.BytesAvailable == 23) pause(.1)

uid = fscanf(s); % baca UID(melalui serial COM) if (isempty(uid)==1)

continue; end

uid = strtrim(uid); %membuang karakter selain karakter huruf dan angka

sprintf('%s',uid)

set(handles.txt_MEMBERID,'String',uid); flushinput(s);

(12)

flushinput(s);

set(handles.txtMSG,'String','Finish scanning card...'); pause(1);

set(handles.txtMSG,'String','Register ID Card complete !'); pause(2);

set(handles.txtMSG,'String','Register your finger');

% --- Executes on button press in btn_scanFJ.

function btn_scanFJ_Callback(hObject, eventdata, handles)

% hObject handle to btn_scanFJ (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

load('IDf.mat') IDf = IDf + 1;

%s = serial('com11','timeout',1); %fopen(s);

global IDftemp; global s;

set(handles.txtMSG,'String','Start scanning finger...');

pause(.1); fwrite(s,'@'); pause(1);

while 1

pause(.1)

finger = fscanf(s); % baca Serial COM

finger = strtrim(finger); % membuang karakter selain karakter huruf dan angka

sprintf('%s',finger)

set(handles.txtMSG,'String',finger);

if (finger == '~') % jika buffer input Matlab sdh kosong, keluar

break; end end

flushinput(s); fclose(s);

set(handles.txtMSG,'String','Scan finger completed'); IDftemp=IDf;

IDftemp = sprintf('ID %d',IDftemp); set(handles.txtFINGER,'String',IDftemp);

set(handles.txtMSG,'String','Identity completed');

save('IDf.mat','IDf');

% --- Executes on button press in btn_SIMPAN.

function btn_SIMPAN_Callback(hObject, eventdata, handles)

(13)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global IDftemp; load('row.mat') load('sat.mat') load('pul.mat') load('ratus.mat') load('lipat10.mat') load('lipat100.mat')

n = 1; msgn = 0;

a = get(handles.edtxt_NAMA,'String'); b = get(handles.edtxt_ALAMAT,'String'); c = get(handles.edtxt_TTL,'String'); d = get(handles.edtxt_TELPHP,'String'); e = get(handles.edtxt_EMAIL,'String'); f = get(handles.txt_MEMBERID,'String'); g = IDftemp;

identitas = {g,f,a,b,c,d,e};

sat = sat + 1; if sat >= lipat10 pul = pul + 1; sat = 0;

lipat10 = lipat10+10; if pul >= lipat100

ratus = ratus + 1; pul = 0;

lipat100 = lipat100+100; end

end

sat = num2str(sat); pul = num2str(pul); ratus = num2str(ratus);

row = sprintf('A%c%c%c',ratus,pul,sat);

sat = str2num(sat); pul = str2num(pul); ratus = str2num(ratus);

xlswrite('Daftar_Anggota.xlsx',identitas,1,row);

save('row.mat','row') save('sat.mat','sat') save('pul.mat','pul') save('ratus.mat','ratus') save('lipat10.mat','lipat10') save('lipat100.mat','lipat100')

(14)

% --- Executes during object creation, after setting all properties.

function text3_CreateFcn(hObject, eventdata, handles)

% hObject handle to text3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes on button press in btn_OK.

function btn_OK_Callback(hObject, eventdata, handles)

% hObject handle to btn_OK (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global dklik;

if dklik == 1

choice = menu('Are you sure want to finish the Registration ?

if not keep filling', 'Yes', 'No')

if (choice == 1)

set(handles.uipanel1,'Visible','off'); else

end else

msgbox('Tekan tombol simpan terlebih

dahulu','peringatan','modal');

end

set(handles.uipanel5,'Visible','on');

% --- Executes during object creation, after setting all properties.

function text2_CreateFcn(hObject, eventdata, handles)

% hObject handle to text2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function uipanel1_CreateFcn(hObject, eventdata, handles)

% hObject handle to uipanel1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

function edtxt_NAMA_Callback(hObject, eventdata, handles)

% hObject handle to edtxt_NAMA (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

(15)

% --- Executes during object creation, after setting all properties.

function edtxt_NAMA_CreateFcn(hObject, eventdata, handles)

% hObject handle to edtxt_NAMA (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

function edtxt_ALAMAT_Callback(hObject, eventdata, handles)

% hObject handle to edtxt_ALAMAT (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes during object creation, after setting all properties.

function edtxt_ALAMAT_CreateFcn(hObject, eventdata, handles)

% hObject handle to edtxt_ALAMAT (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

function edtxt_TTL_Callback(hObject, eventdata, handles)

% hObject handle to edtxt_TTL (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edtxt_TTL as text

% str2double(get(hObject,'String')) returns contents of edtxt_TTL as a double

(16)

function edtxt_TTL_CreateFcn(hObject, eventdata, handles)

% hObject handle to edtxt_TTL (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

function edtxt_TELPHP_Callback(hObject, eventdata, handles)

% hObject handle to edtxt_TELPHP (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

% --- Executes during object creation, after setting all properties.

function edtxt_TELPHP_CreateFcn(hObject, eventdata, handles)

% hObject handle to edtxt_TELPHP (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

function edtxt_EMAIL_Callback(hObject, eventdata, handles)

% hObject handle to edtxt_EMAIL (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of edtxt_EMAIL as text

% str2double(get(hObject,'String')) returns contents of edtxt_EMAIL as a double

% --- Executes during object creation, after setting all properties.

function edtxt_EMAIL_CreateFcn(hObject, eventdata, handles)

(17)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

function txt_MEMBERID_Callback(hObject, eventdata, handles)

% hObject handle to txt_MEMBERID (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA) % Hints: get(hObject,'String') returns contents of txt_MEMBERID as text

% str2double(get(hObject,'String')) returns contents of txt_MEMBERID as a double

% --- Executes during object creation, after setting all properties.

function txt_MEMBERID_CreateFcn(hObject, eventdata, handles)

% hObject handle to txt_MEMBERID (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: edit controls usually have a white background on Windows. % See ISPC and COMPUTER.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))

set(hObject,'BackgroundColor','white'); end

% --- Executes during object creation, after setting all properties.

function text8_CreateFcn(~, eventdata, handles)

% hObject handle to text8 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text9_CreateFcn(hObject, eventdata, handles)

% hObject handle to text9 (see GCBO)

(18)

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text10_CreateFcn(hObject, eventdata, handles)

% hObject handle to text10 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text11_CreateFcn(hObject, eventdata, handles)

% hObject handle to text11 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text12_CreateFcn(hObject, eventdata, handles)

% hObject handle to text12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text13_CreateFcn(hObject, eventdata, handles)

% hObject handle to text13 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function axes1_CreateFcn(hObject, eventdata, handles)

% hObject handle to axes1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

(19)

% --- Executes during object creation, after setting all properties.

function btn_scanID_CreateFcn(hObject, eventdata, handles)

% hObject handle to btn_scanID (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function btn_scanFJ_CreateFcn(hObject, eventdata, handles)

% hObject handle to btn_scanFJ (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function uipanel3_CreateFcn(hObject, eventdata, handles)

% hObject handle to uipanel3 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text18_CreateFcn(hObject, eventdata, handles)

% hObject handle to text18 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function axes2_CreateFcn(hObject, eventdata, handles)

% hObject handle to axes2 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

img = imread('Scan Kartu.jpg'); imshow(img)

(20)

% --- Executes during object creation, after setting all properties.

function uipanel4_CreateFcn(hObject, eventdata, handles)

% hObject handle to uipanel4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function txtMSG_CreateFcn(hObject, eventdata, handles)

% hObject handle to txtMSG (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function uipanel5_CreateFcn(hObject, eventdata, handles)

% hObject handle to uipanel5 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text23_CreateFcn(hObject, eventdata, handles)

% hObject handle to text23 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text25_CreateFcn(hObject, eventdata, handles)

% hObject handle to text25 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function text26_CreateFcn(hObject, eventdata, handles)

% hObject handle to text26 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

(21)

% --- Executes during object creation, after setting all properties.

function axes4_CreateFcn(hObject, eventdata, handles)

% hObject handle to axes4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% handles empty - handles not created until after all CreateFcns called

img = imread('front_page.png'); imshow(img)

% Hint: place code in OpeningFcn to populate axes4 % --- Executes on button press in Verifikasi.

function Verifikasi_Callback(hObject, eventdata, handles)

% hObject handle to Verifikasi (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global s;

status = s.Status; if status(1,4) == 's'

newstatus = char(zeros(1,4)); for i=1:4

newstatus(1,i)= status(1,i); end

status = newstatus; end

if (status == 'open') pause(.1);

else

fopen(s); delay(.1);

i = 0; n = 0;

while i <= 4 i = i+1; n = fscanf(s)

pause(.1); n = strtrim(n);

set(handles.txtMSG,'String', n);

if (i==4)

sz = size(n); if (sz <= 1)

if (n == '~') break

else

(22)

set(handles.txtMSG,'String', 'Serial data

error, unplug and plug or reprogram Arduino');

break; end end else

set(handles.txtMSG,'String', 'Serial data error,

unplug and plug or reprogram Arduino');

break; end end end end

while 1

axes(handles.axes4);

gmb = imread('Scan Kartunya.jpg'); imshow(gmb);

set(handles.txtMSG,'String','Please verify'); set(handles.uipanel5,'Visible','off');

set(handles.uipanel3,'Visible','on');

[~,~,UIDx] = xlsread('Daftar_Anggota',1,'A4:G50'); %membaca file database (daftar anggota.xls) dan menyimpannya ke variabel UIDx

fwrite(s,'#'); pause(.1);

while 1

if (s.BytesAvailable == 23)

uid = fscanf(s); % baca UID(melalui serial COM)

pause(.5); if (isempty(uid)==1) continue;

end

uid = strtrim(uid); %membuang karakter selain karakter huruf dan angka

sprintf('%s',uid) flushinput(s); break;

end end

set(handles.txtMSG,'String','Verifying...'); inow = 1;

det=0;

while(inow<=47 && det~=1)

%DATA PRIBADI TERDAFTAR

if uid == UIDx{inow,2}

%FIGURE DATA PRIBADI

axes(handles.axes4);

gmb = imread('Verifikasi Berhasil.jpg'); imshow(gmb);

pause(3);

(23)

set(handles.txtVerNama,'String',UIDx{inow,3}); set(handles.txtVerAlmat,'String',UIDx{inow,4}); set(handles.txtVerTTL,'String',UIDx{inow,5}); set(handles.txtVerEmail,'String',UIDx{inow,6}); set(handles.txtVerEmail,'String',UIDx{inow,7});

set(handles.textVerUID,'String',UIDx{inow,2}); set(handles.txtVerIDfin,'String',UIDx{inow,1});

pause(3);

set(handles.uipanel6,'Visible','off'); pause(1);

det=1; end

inow=inow+1; end

if(det~=1)

%FIGURE DATA TIDAK TERDAFTAR

axes(handles.axes4);

gmb = imread('Verifikasi Gagal.jpg'); imshow(gmb);

pause(3);

gmb = imread('Scan Kartunya.jpg'); imshow(gmb);

end

flushinput(s); pause(1); end

% --- Executes during object creation, after setting all properties.

function Verifikasi_CreateFcn(hObject, eventdata, handles)

% hObject handle to Verifikasi (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function txtVerNama_CreateFcn(hObject, eventdata, handles)

% hObject handle to txtVerNama (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function textResult_CreateFcn(hObject, eventdata, handles)

% hObject handle to textResult (see GCBO)

(24)

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function textVerAlmat_CreateFcn(hObject, eventdata, handles)

% hObject handle to textVerAlmat (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function textVerTTL_CreateFcn(hObject, eventdata, handles)

% hObject handle to textVerTTL (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function textVerTelp_CreateFcn(hObject, eventdata, handles)

% hObject handle to textVerTelp (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function textVerEmail_CreateFcn(hObject, eventdata, handles)

% hObject handle to textVerEmail (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function textVerUID_CreateFcn(hObject, eventdata, handles)

% hObject handle to textVerUID (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

(25)

function uipanel6_CreateFcn(hObject, eventdata, handles)

% hObject handle to uipanel6 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function btn_OK_CreateFcn(hObject, eventdata, handles)

% hObject handle to btn_OK (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function txtFINGER_CreateFcn(hObject, eventdata, handles)

% hObject handle to txtFINGER (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function figure1_CreateFcn(hObject, eventdata, handles)

% hObject handle to figure1 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes on button press in pushbutton12.

function pushbutton12_Callback(hObject, eventdata, handles)

% hObject handle to pushbutton12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles structure with handles and user data (see GUIDATA)

global s;

status = s.Status; if status(1,4) == 's'

newstatus = char(zeros(1,4)); for i=1:4

newstatus(1,i)= status(1,i); end

status = newstatus; end

(26)

else

pause(.1); end

set(handles.uipanel1,'Visible','off'); set(handles.uipanel3,'Visible','off'); set(handles.uipanel5,'Visible','on');

set(handles.txtMSG,'String', 'Choose Register or Verify...');

% --- Executes during object creation, after setting all properties.

function pushbutton12_CreateFcn(hObject, eventdata, handles)

% hObject handle to pushbutton12 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function axes5_CreateFcn(hObject, eventdata, handles)

% hObject handle to axes4 (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes4

% --- Executes during object creation, after setting all properties.

function txtVerTelp_CreateFcn(hObject, eventdata, handles)

% hObject handle to txtVerTelp (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

% handles empty - handles not created until after all CreateFcns called

% --- Executes during object creation, after setting all properties.

function txtVerIDfin_CreateFcn(hObject, eventdata, handles)

% hObject handle to txtVerIDfin (see GCBO)

% eventdata reserved - to be defined in a future version of MATLAB

Referensi

Dokumen terkait

Instrumen penelitian pada penelitian ini menggunakan kuesioner untuk mengetahui perilaku beresiko masyarakat terhadap demam berdarah dengue (DBD), dan keberadaan

Sehubungan dengan itu, Lembaga Penelitian Universitas Negeri Padang bekerjasama dengan Pimpinan Universitas, telah memfasilitasi peneliti untuk melaksanakan penelitian

Demikian juga dengan kepemimpinan manajer yang menunjukkan kategori kurang baik dengan persentase 70%.Hasil penelitian ini juga menunjukkan bahwa adanya hubungan yang

yang ditemukan selama pengamatan adalah Gejala serangan Penggerek Batang padi, populasi Wereng hijau dan Walang sangit (lihat gambar 4, 5 dan Lampiran 2), Hasil pengamatan rata

Sistem monitoring yang dimaksud pada penelitian ini adalah pengukuran tegangan dan arus sedangkan nilai daya dan faktor daya didapat dari hasil perhitungan menggunakan

Yohanes Indrayono/Iman Santoso, S.E.. Yohanes Indrayono/Iman

Dalam pembuatan iklan animasi motion graphic diperlukan 3 tahap pembuatan yaitu tahap pra produksi dimana pada tahap ini terdapat 4 proses yang dilakukan penulis, proses tersebut

Artinya, konten pendidikan yang dirumuskan dalam Standar Kompetensi Lulusan dan dikembangkan dalam kurikulum harus menjadi dasar bagi peserta didik untuk dikembangkan dan