Program for R306 fingerprint module interfaced with Wiz750SR S2E device
Dependencies: FPC_R306 MQTT WIZnetInterface mbed
Fork of GT511C3_TimeStamp_WIZwiki-W7500 by
main.cpp
- Committer:
- tosihisa
- Date:
- 2014-01-03
- Revision:
- 3:459a4f985a45
- Parent:
- 2:34a647292050
- Child:
- 4:3dd0f98e6f09
File content as of revision 3:459a4f985a45:
#include "mbed.h" #include "GT511C3.h" Serial debug(USBTX,USBRX); DigitalOut myled(LED1); GT511C3 finger(p28,p27); int Enroll(void) { int EnrollID = 10; unsigned long Parameter = 0; unsigned short Response = 0; int sts = 0; debug.printf("EnrollStart\n"); finger.CmosLed(1); while(1){ debug.printf("CMD_EnrollStart\n"); Parameter = EnrollID; sts = finger.SendRecv(GT511C3::CMD_EnrollStart,&Parameter,&Response); debug.printf("sts = %d,Response=0x%04x Parameter=0x%08lx\n",sts,Response,Parameter); if(sts != 0) return sts; if(Response != GT511C3::CMD_Ack) return -100; debug.printf("Remove finger\n"); finger.WaitPress(0); while(1){ debug.printf("Press finger to Enroll (1st)\n"); finger.WaitPress(1); if(finger.Capture(1) == 0) break; } debug.printf("Remove finger\n"); if(finger.Enroll_N(1) != 0) continue; finger.WaitPress(0); while(1){ debug.printf("Press finger to Enroll (2nd)\n"); finger.WaitPress(1); if(finger.Capture(1) == 0) break; } debug.printf("Remove finger\n"); if(finger.Enroll_N(2) != 0) continue; finger.WaitPress(0); while(1){ debug.printf("Press finger to Enroll (3rd)\n"); finger.WaitPress(1); if(finger.Capture(1) == 0) break; } debug.printf("Remove finger\n"); if(finger.Enroll_N(3) != 0) continue; finger.WaitPress(0); debug.printf("Enroll OK!\n"); break; } return 0; } int main() { unsigned long Parameter; unsigned short Response; int sts = 0; int count = 0; int ispress; int ID; debug.format(8,Serial::None,1); debug.baud(115200); debug.printf("Init\n"); finger.Init(); debug.printf("Open\n"); Parameter = 0; sts = finger.SendRecv(GT511C3::CMD_Open,&Parameter,&Response); debug.printf("sts = %d,Response=0x%04x\n",sts,Response); if(1){ Enroll(); } finger.CmosLed(1); while(1) { ispress = finger.IsPress(); debug.printf("IsPressFinger=%d\n",ispress); if(ispress){ if(finger.Capture(1) != 0) continue; ID = finger.Identify(); debug.printf("ID = %d\n",ID); } #if 0 myled = 1; wait(0.5); myled = 0; wait(0.5); #endif count++; } }