0% found this document useful (0 votes)
29 views2 pages

Martin Rojtinić Arduino Zaključavanje Vrata Pomoću Senzora Otiska Prsta (Kod Spoja) 3.E

The document provides code for enrolling a fingerprint into an Arduino fingerprint sensor. It prints messages to the serial monitor asking the user to enter an ID number between 1-127 to save the fingerprint as. It then waits for the user to place a valid finger on the sensor. If a fingerprint is detected, it takes an image and converts it to a template to save in the sensor memory.

Uploaded by

Martin Rojtinic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views2 pages

Martin Rojtinić Arduino Zaključavanje Vrata Pomoću Senzora Otiska Prsta (Kod Spoja) 3.E

The document provides code for enrolling a fingerprint into an Arduino fingerprint sensor. It prints messages to the serial monitor asking the user to enter an ID number between 1-127 to save the fingerprint as. It then waits for the user to place a valid finger on the sensor. If a fingerprint is detected, it takes an image and converts it to a template to save in the sensor memory.

Uploaded by

Martin Rojtinic
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

RAD

Martin Rojtinić Arduino zaključavanje vrata pomoću senzora otiska


prsta(kod spoja)
21.3.2023.
3.E

void loop() // run over and over again


{
Serial.println("Ready to enroll a fingerprint!");
Serial.println("Please type in the ID # (from 1 to 127) you want to save this finger as...");
id = readnumber();
if (id == 0) {// ID #0 not allowed, try again!
return;
}
Serial.print("Enrolling ID #");
Serial.println(id);

while (! getFingerprintEnroll() );
}

uint8_t getFingerprintEnroll() {

int p = -1;
Serial.print("Waiting for valid finger to enroll as #"); Serial.println(id);
while (p != FINGERPRINT_OK) {
p = finger.getImage();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image taken");
break;
case FINGERPRINT_NOFINGER:
Serial.println(".");
break;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
break;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
break;
default:
Serial.println("Unknown error");
break;
}
}

// OK success!

p = finger.image2Tz(1);
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
break;
case FINGERPRINT_IMAGEMESS:
Serial.println("Image too messy");
return p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_FEATUREFAIL:
Serial.println("Could not find fingerprint features");
return p;
case FINGERPRINT_INVALIDIMAGE:
Serial.println("Could not find fingerprint features");
return p;
default:
Serial.println("Unknown error");
return p;
}

You might also like