Fingerprint sensor example with WIZwiki-W7500. 1st release.
Dependencies: GT511C3 mbed-src
Fork of GT511C3test by
main.cpp
00001 #include "mbed.h" 00002 #include "GT511C3.hpp" 00003 00004 #define MAX_ID_NUM 20 00005 00006 Serial debug(USBTX,USBRX); 00007 00008 00009 #ifdef TARGET_WIZWIKI_W7500 00010 GT511C3 finger(PA_13,PA_14); 00011 DigitalIn del_ID(D7); 00012 DigitalIn enroll_ID(D8); 00013 #endif 00014 00015 int progress(int status,char *msg) 00016 { 00017 debug.printf("%s",msg); 00018 return 0; 00019 } 00020 00021 int main() 00022 { 00023 int sts = 0; 00024 int ID = 0; 00025 int cnt = 0; 00026 int EnrollID; 00027 00028 debug.baud(115200); 00029 printf("Try to Open Device....\r\n"); 00030 00031 while(1) 00032 { 00033 sts = finger.Open(); 00034 if(sts == -1) 00035 { 00036 printf("Open failed!!\r\n"); 00037 cnt++; 00038 while(cnt > 5); 00039 } 00040 else 00041 { 00042 printf("Open Success!!\r\n"); 00043 break; 00044 } 00045 wait(0.2); 00046 } 00047 00048 if(del_ID == 1) 00049 { 00050 finger.DeleteID_All(); 00051 printf("All ID are deleted!!\r\n"); 00052 } 00053 00054 cnt = 0; 00055 if(enroll_ID == 1) 00056 { 00057 while(1) 00058 { 00059 if(finger.CheckEnrolled(cnt) == -1) 00060 { 00061 EnrollID = cnt; 00062 printf("ID(%d) is empty\r\n", EnrollID); 00063 break; 00064 } 00065 cnt++; 00066 if(cnt > MAX_ID_NUM) 00067 { 00068 printf("\r\nERROR : ID number is fulled!!Delete ID first!!\r\n\r\n"); 00069 while(1); 00070 } 00071 } 00072 finger.Enroll(EnrollID,progress); 00073 } 00074 00075 finger.CmosLed(1); 00076 00077 while(1) 00078 { 00079 printf("Press finger for Identify\r\n"); 00080 finger.WaitPress(1); 00081 if(finger.Capture(1) != 0) 00082 continue; 00083 00084 ID = finger.Identify(); 00085 00086 if(ID == -1) 00087 printf("\r\nERROR : There is no ID!!Enroll first!!\r\n\r\n"); 00088 else 00089 printf("ID = %d\r\n",ID); 00090 00091 printf("Remove finger\r\n"); 00092 finger.WaitPress(0); 00093 00094 } 00095 00096 00097 } 00098
Generated on Fri Jul 29 2022 20:08:09 by 1.7.2