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@7:8b9ef3211cd0, 2014-01-03 (annotated)
- Committer:
- tosihisa
- Date:
- Fri Jan 03 16:03:44 2014 +0000
- Revision:
- 7:8b9ef3211cd0
- Parent:
- 6:016ad8f480d3
- Child:
- 8:574087f87b1e
class library make.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tosihisa | 0:b11b455d4997 | 1 | #include "mbed.h" |
tosihisa | 6:016ad8f480d3 | 2 | #include "GT511C3.hpp" |
tosihisa | 0:b11b455d4997 | 3 | |
tosihisa | 0:b11b455d4997 | 4 | Serial debug(USBTX,USBRX); |
tosihisa | 0:b11b455d4997 | 5 | |
tosihisa | 0:b11b455d4997 | 6 | DigitalOut myled(LED1); |
tosihisa | 0:b11b455d4997 | 7 | GT511C3 finger(p28,p27); |
tosihisa | 0:b11b455d4997 | 8 | |
tosihisa | 5:d3ebe6d1ed92 | 9 | int progress(int status,char *msg) |
tosihisa | 2:34a647292050 | 10 | { |
tosihisa | 5:d3ebe6d1ed92 | 11 | debug.printf("%s",msg); |
tosihisa | 3:459a4f985a45 | 12 | return 0; |
tosihisa | 2:34a647292050 | 13 | } |
tosihisa | 2:34a647292050 | 14 | |
tosihisa | 0:b11b455d4997 | 15 | int main() { |
tosihisa | 0:b11b455d4997 | 16 | int sts = 0; |
tosihisa | 4:3dd0f98e6f09 | 17 | int ID = 0; |
tosihisa | 0:b11b455d4997 | 18 | |
tosihisa | 0:b11b455d4997 | 19 | debug.format(8,Serial::None,1); |
tosihisa | 0:b11b455d4997 | 20 | debug.baud(115200); |
tosihisa | 0:b11b455d4997 | 21 | |
tosihisa | 7:8b9ef3211cd0 | 22 | debug.printf("Fingerprint reader module \"GT-511C3 / GT-511C31\" test program.\n"); |
tosihisa | 7:8b9ef3211cd0 | 23 | debug.printf("Build: %s %s\n",__DATE__,__TIME__); |
tosihisa | 7:8b9ef3211cd0 | 24 | |
tosihisa | 0:b11b455d4997 | 25 | debug.printf("Open\n"); |
tosihisa | 4:3dd0f98e6f09 | 26 | sts = finger.Open(); |
tosihisa | 4:3dd0f98e6f09 | 27 | debug.printf("sts = %d\n",sts); |
tosihisa | 4:3dd0f98e6f09 | 28 | if(sts == 0){ |
tosihisa | 4:3dd0f98e6f09 | 29 | int i; |
tosihisa | 4:3dd0f98e6f09 | 30 | debug.printf("FirmwareVersion = %lx\n",finger.FirmwareVersion); |
tosihisa | 4:3dd0f98e6f09 | 31 | debug.printf("IsoAreaMaxSize = %ld\n",finger.IsoAreaMaxSize); |
tosihisa | 4:3dd0f98e6f09 | 32 | debug.printf("DeviceSerialNumber = "); |
tosihisa | 4:3dd0f98e6f09 | 33 | for(i = 0; i < sizeof(finger.DeviceSerialNumber);i++){ |
tosihisa | 4:3dd0f98e6f09 | 34 | debug.printf("%02X",finger.DeviceSerialNumber[i]); |
tosihisa | 4:3dd0f98e6f09 | 35 | } |
tosihisa | 4:3dd0f98e6f09 | 36 | debug.printf("\n"); |
tosihisa | 4:3dd0f98e6f09 | 37 | } |
tosihisa | 0:b11b455d4997 | 38 | |
tosihisa | 3:459a4f985a45 | 39 | if(1){ |
tosihisa | 6:016ad8f480d3 | 40 | int EnrollID = 11; |
tosihisa | 6:016ad8f480d3 | 41 | if(finger.CheckEnrolled(EnrollID) == 0){ |
tosihisa | 6:016ad8f480d3 | 42 | debug.printf("EnrollID(%d) is already enrolled.Delete!\n",EnrollID); |
tosihisa | 6:016ad8f480d3 | 43 | if(finger.DeleteID(EnrollID) == 0){ |
tosihisa | 6:016ad8f480d3 | 44 | debug.printf("Delete OK!\n"); |
tosihisa | 6:016ad8f480d3 | 45 | } |
tosihisa | 6:016ad8f480d3 | 46 | } |
tosihisa | 6:016ad8f480d3 | 47 | finger.Enroll(EnrollID,progress); |
tosihisa | 3:459a4f985a45 | 48 | } |
tosihisa | 3:459a4f985a45 | 49 | |
tosihisa | 3:459a4f985a45 | 50 | finger.CmosLed(1); |
tosihisa | 0:b11b455d4997 | 51 | while(1) { |
tosihisa | 6:016ad8f480d3 | 52 | debug.printf("Press finger for Identify\n"); |
tosihisa | 5:d3ebe6d1ed92 | 53 | finger.WaitPress(1); |
tosihisa | 5:d3ebe6d1ed92 | 54 | if(finger.Capture(1) != 0) |
tosihisa | 5:d3ebe6d1ed92 | 55 | continue; |
tosihisa | 5:d3ebe6d1ed92 | 56 | ID = finger.Identify(); |
tosihisa | 5:d3ebe6d1ed92 | 57 | debug.printf("ID = %d\n",ID); |
tosihisa | 5:d3ebe6d1ed92 | 58 | debug.printf("Remove finger\n"); |
tosihisa | 5:d3ebe6d1ed92 | 59 | finger.WaitPress(0); |
tosihisa | 0:b11b455d4997 | 60 | } |
tosihisa | 0:b11b455d4997 | 61 | } |