David Bruce 15597305

Dependencies:   mbed N5110 GT511C3

Revision:
2:61e0f5bec6ff
Parent:
1:4c720110a2a8
Child:
3:938a2d4ae661
--- a/main.cpp	Tue Dec 01 20:49:44 2015 +0000
+++ b/main.cpp	Thu Dec 03 05:22:09 2015 +0000
@@ -36,25 +36,47 @@
         debug.printf("\n");
     }
  
+    // Deletes All Fingerprints enrolled in the database
+    debug.printf("Deleting IDs = %d\n", finger.DeleteAllIDs());
  
-    int EnrollID = -1;
+    // How to create and download a template from the scanner
+    // Setting the enrollID to -1 tells the scanner to not save the template but
+    // instead to send the data to the host.
+    int EnrollID = -1;  
+    // The size of one template
     unsigned char data[498];
-    debug.printf("Deleting IDs = %d\n", finger.DeleteAllIDs());
+    // Create a template with the scanner
     finger.Enroll(EnrollID,progress);
+    // Receive the template from the scanner
     debug.printf("RecvData = %d\n", finger.RecvData(data, 498));
     debug.printf("Data[0-3] = %X %X %X %X\n", data[0], data[1],data[2],data[3]);
+    
+    // Since we have a template we want to enroll in the database
+    // We call SetTemplate which will upload the template to the scanner
+    // 11 is the ID that this template will be enrolled in
     debug.printf("SetTemplate = %d\n", finger.SetTemplate(11,data,498));
     
  
+    // Turn on the scanner backlight so we can get good captures
+    // during identification testing
     finger.CmosLed(1);
     while(1) {
         debug.printf("Press finger for Identify\n");
+        // Wait for a finger on the scanner
         finger.WaitPress(1);
+        // Wait until we get a good capture
         if(finger.Capture(1) != 0)
             continue;
+            
+        // Now that we have a good capute identify the finger
         ID = finger.Identify();
+        
+        // If you used the same finger this should return 11
+        // Otherwise this will return -1
         debug.printf("ID = %d\n",ID);
         debug.printf("Remove finger\n");
+        
+        // Wait until the finger is removed so we don't double identify a finger
         finger.WaitPress(0);
     }
 }
\ No newline at end of file