Fingerprint Sensor SEN0359 - count the “Matching fails”
I have the Capacitive Fingerprint Sensor SEN0359 running on a WeMos D1 mini PRO 32Mbit ESP8266 and everything works fine!
The attached original sketch (“Sample Code 3 - Fingerprint Matching”) is working as well and has at this moment two exits, meaning do something or rather Serial.println “Matching succeeds” or “Matching fails”.
Now I would like to have a third option. The sketch should count the “Matching fails” within the last 10 minutes. If the counting exceeds the number of let say 8, the sketch should give me a new exit (e.g. Serial.println “Fingerprint locked”). Minutes and counts should be variable.
Can anyone help me with this story/idea?
Many thanks!
You can introduce three int variables acb, representing the number of recognition, the number of successful matches, and the number of failed matches. For each successful match or failed match, the total number of times and the number of results are increased by one. When the total number of times reaches 10, the statistical result is output.You can complete the project with the for() loop.
WinsterMany thanks for this hint! I decided to ignore the time period, meaning “false finger is false finger”, regardess of the time. A correct finger is setting all back to zero. The following part is doing what I was looking for.
int CountFails = 0;
…
if(ret != 0){ /*Set fingerprint LED ring to always ON in green */ fingerprint.ctrlLED(/*LEDMode = */fingerprint.eKeepsOn, /*LEDColor = */fingerprint.eLEDGreen, /*blinkCount = */0); Serial.print("Matching succeeds,ID="); Serial.println(ret); CountFails = 0; } else if (CountFails >= 5){ Serial.print("Door Locked"); } else{ /*Set fingerprint LED ring to always ON in red*/ fingerprint.ctrlLED(/*LEDMode = */fingerprint.eKeepsOn, /*LEDColor = */fingerprint.eLEDRed, /*blinkCount = */0); Serial.println("Matching fails"); CountFails++; }