"Sensor contains 0 templates"

Disclaimer: I am still a beginner at Arduino so kindly bear with me if ever I miss uploading something in this topic. Thank you!

Hello, I am uncertain whether this is normal or not, however this is what comes up in the serial monitor when I upload my code to the microcontroller:
17:09:44.159 -> Adafruit finger detect test
17:09:44.159 -> Found fingerprint sensor!
17:09:44.192 -> Sensor contains 0 templates
17:09:44.224 -> Waiting for valid finger...

For reference:
Microcontroller - NodeMCU ESP8266 CP2102
Display - OLED I2C
Fingerprint Sensor - AS608

The OLED display does reflect the code, indicating that it is working. I am quite concerned as to why the serial monitor indicates that there are "0" templates. I also attempted to reseat the wires of the tx and rx, even switching them and putting it back to its initial position. Despite that, the output is still the same. The fingerprint is able to read my thumb or index, however I do not know how to enroll the fingerprint id nor if it is even enrolling my fingerprints. The OLED display reflects a fingerprint icon with an "x" beside it after I attempt to scan my fingerprint by locking it in place for a few seconds. I do have my code with me, I am just unsure what to send. Thank you for the help!

It would be much easier to solve your problem if we knew exactly what you have. Post your annotated schematic that shows all parts, power sources, ground connections, etc. Links to technical information on the parts will help. Links to azon and similar market places usually do not have the needed information.

zayum1|690x466

Here it is

1 Like

The project is basically an IoT Fingerprint Sensor wherein the fingerprints are stored in a local server using xampp. I'll try to see how I can upload the file of my code here - for a moment.

Update: Arduino Forum says new users can't upload the attachment/file of my code as I am a new user. So I have to manually input all my code here?

Do not attach the file, select all code and insert it to the message using code tags.

P.S. don't mind the ssid, password, and url. I simply replaced them with placeholders.

#include <SPI.h>
#include <Wire.h>
#include <WiFiClient.h>
#include <ESP8266WiFi.h>
#include <SoftwareSerial.h>
#include <ESP8266WebServer.h>
#include <ESP8266HTTPClient.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Fingerprint.h>
#define Finger_Rx 14  //D5
#define Finger_Tx 12  //D6
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET 0
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
SoftwareSerial mySerial(Finger_Rx, Finger_Tx);
Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
const char *ssid = "name";
const char *password = "pass";
String postData;
String link = "http://url/biometricattendance/getdata.php";
int FingerID = 0;
uint8_t id;
#define Wifi_start_width 54
#define Wifi_start_height 49
const uint8_t PROGMEM Wifi_start_bits[] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x1f, 0xf0, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x38, 0x00, 0x07, 0xc0, 0x00, 0x38, 0x00, 0x70, 0x00, 0xff, 0xfe, 0x00, 0x1e, 0x00, 0xe0, 0x03, 0xfc, 0x7f, 0xc0, 0x0e, 0x00, 0x00, 0x1f, 0x80, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x07, 0x1e, 0x00, 0x00, 0x00, 0xff, 0xfe, 0x1f, 0xbf, 0x80, 0x00, 0x03, 0xe0, 0x04, 0x7f, 0xff, 0xc0, 0x00, 0x07, 0x80, 0x00, 0xff, 0xff, 0xe0, 0x00, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x00, 0x0c, 0x00, 0x00, 0x7f, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x03, 0xf8, 0x03, 0xf8, 0x00, 0x00, 0x07, 0xe7, 0xf9, 0xf1, 0xfc, 0x00, 0x00, 0x1f, 0xe7, 0xf1, 0xf9, 0xfc, 0x00, 0x00, 0x1f, 0xe7, 0xf3, 0xf9, 0xfc, 0x00, 0x00, 0x3f, 0xe7, 0xf3, 0xf9, 0xfc, 0x00, 0x00, 0x3f, 0xe7, 0xf1, 0xf1, 0xfc, 0x00, 0x00, 0x3f, 0xe3, 0xf8, 0xe3, 0xfc, 0x00, 0x00, 0x3f, 0xf3, 0xfc, 0x07, 0xf8, 0x00, 0x00, 0x1f, 0xf0, 0x7f, 0x0f, 0xc0, 0x00, 0x00, 0x0f, 0xe0, 0x7f, 0xff, 0xe0, 0x00, 0x00, 0x07, 0xc0, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#define Wifi_connected_width 63
#define Wifi_connected_height 49
const uint8_t PROGMEM Wifi_connected_bits[] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x3f, 0xff, 0xc0, 0x07, 0xff, 0xf8, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00, 0x3f, 0xfe, 0x00, 0x03, 0xff, 0x80, 0x00, 0x00, 0x03, 0xff, 0x80, 0x07, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0xc0, 0x1f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf0, 0x3f, 0xe0, 0x01, 0xff, 0xff, 0x00, 0x0f, 0xf8, 0x7f, 0x80, 0x0f, 0xff, 0xff, 0xe0, 0x03, 0xfc, 0xff, 0x00, 0x7f, 0xff, 0xff, 0xfc, 0x01, 0xfe, 0xfc, 0x01, 0xff, 0xff, 0xff, 0xff, 0x00, 0x7e, 0x78, 0x07, 0xff, 0xc0, 0x07, 0xff, 0xc0, 0x3c, 0x00, 0x0f, 0xfc, 0x00, 0x00, 0x7f, 0xe0, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x3f, 0xc0, 0x00, 0x00, 0x07, 0xf8, 0x00, 0x00, 0x7f, 0x00, 0x01, 0x00, 0x01, 0xfc, 0x00, 0x00, 0x7e, 0x00, 0x7f, 0xfc, 0x00, 0xfc, 0x00, 0x00, 0x3c, 0x03, 0xff, 0xff, 0x80, 0x78, 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf0, 0x1f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x80, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#define FinPr_start_width 64
#define FinPr_start_height 64
const uint8_t PROGMEM FinPr_start_bits[] = {
  0x00, 0x00, 0x00, 0x1f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x01, 0xe0, 0xff, 0xfe, 0x07, 0x80, 0x00, 0x00, 0x03, 0xc3, 0xff, 0xff, 0x03, 0x80, 0x00, 0x00, 0x03, 0x87, 0xc0, 0x07, 0xc3, 0xc0, 0x00, 0x00, 0x07, 0x0f, 0x00, 0x03, 0xe1, 0xc0, 0x00, 0x00, 0x0f, 0x0e, 0x00, 0x00, 0xe0, 0xe0, 0x00, 0x00, 0x0e, 0x1c, 0x00, 0x00, 0xf0, 0xe0, 0x00, 0x00, 0x0c, 0x3c, 0x1f, 0xe0, 0x70, 0xe0, 0x00, 0x00, 0x00, 0x38, 0x3f, 0xf0, 0x38, 0x70, 0x00, 0x00, 0x00, 0x78, 0x78, 0xf8, 0x38, 0x70, 0x00, 0x00, 0x00, 0x70, 0x70, 0x3c, 0x18, 0x70, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x1e, 0x1c, 0x70, 0x00, 0x00, 0x03, 0xe1, 0xe0, 0x0e, 0x1c, 0x70, 0x00, 0x00, 0x0f, 0xc1, 0xc3, 0x0e, 0x1c, 0x70, 0x00, 0x00, 0x3f, 0x03, 0xc3, 0x8e, 0x1c, 0x70, 0x00, 0x00, 0x3e, 0x03, 0x87, 0x0e, 0x1c, 0x70, 0x00, 0x00, 0x30, 0x07, 0x07, 0x0e, 0x18, 0xe0, 0x00, 0x00, 0x00, 0x0e, 0x0e, 0x0e, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x3e, 0x1e, 0x1e, 0x38, 0xe0, 0x00, 0x00, 0x00, 0xf8, 0x1c, 0x1c, 0x38, 0xe0, 0x00, 0x00, 0x03, 0xf0, 0x38, 0x3c, 0x38, 0xe0, 0x00, 0x00, 0x3f, 0xc0, 0xf8, 0x78, 0x38, 0xe0, 0x00, 0x00, 0x7f, 0x01, 0xf0, 0x70, 0x38, 0xf0, 0x00, 0x00, 0x78, 0x03, 0xe0, 0xe0, 0x38, 0x70, 0x00, 0x00, 0x00, 0x0f, 0x81, 0xe0, 0x38, 0x7c, 0x00, 0x00, 0x00, 0x3f, 0x03, 0xc0, 0x38, 0x3e, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x80, 0x38, 0x1e, 0x00, 0x00, 0x07, 0xf0, 0x1f, 0x1c, 0x1c, 0x04, 0x00, 0x00, 0x3f, 0xc0, 0x3e, 0x3f, 0x1e, 0x00, 0x00, 0x00, 0x7f, 0x00, 0xf8, 0x7f, 0x0f, 0x00, 0x00, 0x00, 0x38, 0x01, 0xf0, 0xf7, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xe1, 0xe3, 0x83, 0xf8, 0x00, 0x00, 0x00, 0x3f, 0x87, 0xc3, 0xc0, 0xfc, 0x00, 0x00, 0x01, 0xfe, 0x0f, 0x81, 0xe0, 0x3c, 0x00, 0x00, 0x0f, 0xf8, 0x1f, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x1f, 0xc0, 0x7c, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x1e, 0x01, 0xf8, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x07, 0xe0, 0x78, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x3f, 0x81, 0xfe, 0x07, 0xf0, 0x00, 0x00, 0x01, 0xfe, 0x07, 0xff, 0x01, 0xf0, 0x00, 0x00, 0x07, 0xf8, 0x0f, 0x87, 0x80, 0x30, 0x00, 0x00, 0x07, 0xc0, 0x3f, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x06, 0x00, 0xfc, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x3f, 0x80, 0x00, 0x00, 0x00, 0x7f, 0x00, 0xf8, 0x0f, 0x80, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xfe, 0x01, 0x80, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0xff, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x03, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x01, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00
};
#define FinPr_valid_width 64
#define FinPr_valid_height 64
const uint8_t PROGMEM FinPr_valid_bits[] = {
  0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x0e, 0x03, 0xff, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x1c, 0x1f, 0xff, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x3c, 0x3f, 0xff, 0xf0, 0x78, 0x00, 0x00, 0x00, 0x78, 0x7c, 0x00, 0xf8, 0x3c, 0x00, 0x00, 0x00, 0x70, 0xf0, 0x00, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0xe1, 0xe0, 0x00, 0x1e, 0x1c, 0x00, 0x00, 0x00, 0xe1, 0xc0, 0x00, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0xc3, 0x81, 0xfc, 0x07, 0x0e, 0x00, 0x00, 0x00, 0x03, 0x83, 0xff, 0x07, 0x8e, 0x00, 0x00, 0x00, 0x07, 0x07, 0x8f, 0x83, 0x87, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x03, 0xc3, 0x87, 0x00, 0x00, 0x00, 0x1e, 0x0e, 0x01, 0xc3, 0x87, 0x00, 0x00, 0x00, 0x3c, 0x1c, 0x00, 0xe1, 0x87, 0x00, 0x00, 0x00, 0xf8, 0x1c, 0x30, 0xe1, 0x87, 0x00, 0x00, 0x07, 0xf0, 0x38, 0x70, 0xe1, 0x86, 0x00, 0x00, 0x07, 0xc0, 0x78, 0x70, 0xe3, 0x8e, 0x00, 0x00, 0x02, 0x00, 0xf0, 0xf0, 0xe3, 0x8e, 0x00, 0x00, 0x00, 0x01, 0xe0, 0xe0, 0xe3, 0x8e, 0x00, 0x00, 0x00, 0x03, 0xc1, 0xe1, 0xc3, 0x8e, 0x00, 0x00, 0x00, 0x0f, 0x83, 0xc3, 0xc3, 0x8e, 0x00, 0x00, 0x00, 0x7f, 0x07, 0x83, 0x83, 0x0e, 0x00, 0x00, 0x07, 0xfc, 0x0f, 0x07, 0x83, 0x0e, 0x00, 0x00, 0x07, 0xf0, 0x1e, 0x0f, 0x03, 0x0e, 0x00, 0x00, 0x07, 0x80, 0x7c, 0x1e, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3c, 0x03, 0x87, 0x80, 0x00, 0x00, 0x03, 0xf0, 0x78, 0x03, 0x83, 0xc0, 0x00, 0x00, 0x1f, 0xc0, 0xf0, 0x02, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0xe1, 0xc0, 0x0c, 0x00, 0x00, 0x07, 0xfc, 0x03, 0xc3, 0xe1, 0xff, 0xc0, 0x00, 0x07, 0xe0, 0x0f, 0x87, 0xc7, 0xff, 0xf0, 0x00, 0x07, 0x00, 0x3f, 0x0f, 0x0f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x7c, 0x3e, 0x3f, 0xff, 0xfe, 0x00, 0x00, 0x03, 0xf8, 0x7c, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x1f, 0xe0, 0xf0, 0x7f, 0xff, 0xff, 0x80, 0x00, 0xff, 0x83, 0xe0, 0xff, 0xff, 0xff, 0x80, 0x01, 0xfc, 0x07, 0xc1, 0xff, 0xff, 0xe3, 0xc0, 0x01, 0xe0, 0x1f, 0x01, 0xff, 0xff, 0xc3, 0xc0, 0x00, 0x00, 0xfe, 0x01, 0xff, 0xff, 0x87, 0xe0, 0x00, 0x03, 0xf8, 0x13, 0xff, 0xff, 0x0f, 0xe0, 0x00, 0x1f, 0xe0, 0x73, 0xff, 0xfe, 0x1f, 0xe0, 0x00, 0x7f, 0x81, 0xf3, 0xff, 0xfc, 0x1f, 0xe0, 0x00, 0xfc, 0x03, 0xe3, 0xef, 0xf8, 0x3f, 0xe0, 0x00, 0x60, 0x0f, 0xc3, 0xc7, 0xf0, 0x7f, 0xe0, 0x00, 0x00, 0x3f, 0x03, 0xc3, 0xe0, 0xff, 0xe0, 0x00, 0x00, 0xfc, 0x03, 0xc1, 0xc1, 0xff, 0xe0, 0x00, 0x07, 0xf0, 0x13, 0xe0, 0x83, 0xff, 0xe0, 0x00, 0x0f, 0xc0, 0x7b, 0xf8, 0x07, 0xff, 0xe0, 0x00, 0x0f, 0x01, 0xf9, 0xfc, 0x0f, 0xff, 0xc0, 0x00, 0x00, 0x07, 0xf1, 0xfe, 0x1f, 0xff, 0xc0, 0x00, 0x00, 0x1f, 0xc0, 0xff, 0x3f, 0xff, 0x80, 0x00, 0x00, 0x7e, 0x00, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0xfc, 0x00, 0x7f, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x3f, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x1f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x01, 0xff, 0x8f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x03, 0xe0, 0xe3, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x7f, 0x00, 0x00
};
#define FinPr_invalid_width 64
#define FinPr_invalid_height 64
const uint8_t PROGMEM FinPr_invalid_bits[] = {
  0x00, 0x00, 0x03, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x03, 0xe0, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x07, 0x80, 0x00, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x0e, 0x03, 0xff, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x1c, 0x1f, 0xff, 0xe0, 0xf0, 0x00, 0x00, 0x00, 0x3c, 0x3f, 0xff, 0xf0, 0x78, 0x00, 0x00, 0x00, 0x78, 0x7c, 0x00, 0xf8, 0x3c, 0x00, 0x00, 0x00, 0x70, 0xf0, 0x00, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0xe1, 0xe0, 0x00, 0x1e, 0x1c, 0x00, 0x00, 0x00, 0xe1, 0xc0, 0x00, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0xc3, 0x81, 0xfc, 0x07, 0x0e, 0x00, 0x00, 0x00, 0x03, 0x83, 0xff, 0x07, 0x8e, 0x00, 0x00, 0x00, 0x07, 0x07, 0x8f, 0x83, 0x87, 0x00, 0x00, 0x00, 0x0f, 0x0f, 0x03, 0xc3, 0x87, 0x00, 0x00, 0x00, 0x1e, 0x0e, 0x01, 0xc3, 0x87, 0x00, 0x00, 0x00, 0x3c, 0x1c, 0x00, 0xe1, 0x87, 0x00, 0x00, 0x00, 0xf8, 0x1c, 0x30, 0xe1, 0x87, 0x00, 0x00, 0x07, 0xf0, 0x38, 0x70, 0xe1, 0x86, 0x00, 0x00, 0x07, 0xc0, 0x78, 0x70, 0xe3, 0x8e, 0x00, 0x00, 0x02, 0x00, 0xf0, 0xf0, 0xe3, 0x8e, 0x00, 0x00, 0x00, 0x01, 0xe0, 0xe0, 0xe3, 0x8e, 0x00, 0x00, 0x00, 0x03, 0xc1, 0xe1, 0xc3, 0x8e, 0x00, 0x00, 0x00, 0x0f, 0x83, 0xc3, 0xc3, 0x8e, 0x00, 0x00, 0x00, 0x7f, 0x07, 0x83, 0x83, 0x0e, 0x00, 0x00, 0x07, 0xfc, 0x0f, 0x07, 0x83, 0x0e, 0x00, 0x00, 0x07, 0xf0, 0x1e, 0x0f, 0x03, 0x0e, 0x00, 0x00, 0x07, 0x80, 0x7c, 0x1e, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3c, 0x03, 0x87, 0x80, 0x00, 0x00, 0x03, 0xf0, 0x78, 0x03, 0x83, 0xc0, 0x00, 0x00, 0x1f, 0xc0, 0xf0, 0x02, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01, 0xe1, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xfc, 0x03, 0xc3, 0xe1, 0xff, 0xc0, 0x00, 0x07, 0xe0, 0x0f, 0x87, 0xc7, 0xff, 0xf0, 0x00, 0x07, 0x00, 0x3f, 0x0f, 0x0f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x7c, 0x3e, 0x1f, 0xff, 0xfe, 0x00, 0x00, 0x03, 0xf8, 0x7c, 0x3f, 0xff, 0xff, 0x00, 0x00, 0x1f, 0xe0, 0xf0, 0x7f, 0xff, 0xff, 0x00, 0x00, 0xff, 0x83, 0xe0, 0xfe, 0xff, 0xbf, 0x80, 0x01, 0xfc, 0x07, 0xc0, 0xfc, 0x7f, 0x1f, 0xc0, 0x01, 0xe0, 0x1f, 0x01, 0xf8, 0x3e, 0x0f, 0xc0, 0x00, 0x00, 0xfe, 0x01, 0xf8, 0x1c, 0x07, 0xe0, 0x00, 0x03, 0xf8, 0x13, 0xf8, 0x00, 0x0f, 0xe0, 0x00, 0x1f, 0xe0, 0x73, 0xfc, 0x00, 0x1f, 0xe0, 0x00, 0x7f, 0x81, 0xf3, 0xfe, 0x00, 0x3f, 0xe0, 0x00, 0xfc, 0x03, 0xe3, 0xff, 0x00, 0x7f, 0xe0, 0x00, 0x60, 0x0f, 0xc3, 0xff, 0x80, 0xff, 0xe0, 0x00, 0x00, 0x3f, 0x03, 0xff, 0x00, 0x7f, 0xe0, 0x00, 0x00, 0xfc, 0x03, 0xfe, 0x00, 0x3f, 0xe0, 0x00, 0x07, 0xf0, 0x13, 0xfc, 0x00, 0x1f, 0xe0, 0x00, 0x0f, 0xc0, 0x79, 0xf8, 0x08, 0x0f, 0xe0, 0x00, 0x0f, 0x01, 0xf9, 0xf8, 0x1c, 0x0f, 0xc0, 0x00, 0x00, 0x07, 0xf1, 0xfc, 0x3e, 0x1f, 0xc0, 0x00, 0x00, 0x1f, 0xc0, 0xfe, 0x7f, 0x3f, 0x80, 0x00, 0x00, 0x7e, 0x00, 0xff, 0xff, 0xff, 0x80, 0x00, 0x00, 0xfc, 0x00, 0x7f, 0xff, 0xff, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x3f, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x1f, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x01, 0xff, 0x8f, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x03, 0xe0, 0xe3, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x7f, 0x00, 0x00
};
#define FinPr_failed_width 64
#define FinPr_failed_height 64
const uint8_t PROGMEM FinPr_failed_bits[] = {
  0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x1f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x07, 0x00, 0x7f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x06, 0x01, 0xff, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x0c, 0x03, 0xc0, 0x3c, 0x03, 0x80, 0x00, 0x00, 0x1c, 0x0f, 0x00, 0x0e, 0x01, 0x80, 0x00, 0x00, 0x18, 0x0c, 0x00, 0x03, 0x00, 0xc0, 0x00, 0x00, 0x18, 0x18, 0x00, 0x01, 0x80, 0xc0, 0x00, 0x00, 0x30, 0x38, 0x00, 0x01, 0xc0, 0xe0, 0x00, 0x00, 0x30, 0x30, 0x0f, 0x00, 0xc0, 0x60, 0x00, 0x00, 0x30, 0x30, 0x3f, 0xc0, 0xe0, 0x60, 0x00, 0x00, 0x70, 0x60, 0x78, 0xe0, 0x60, 0x60, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x70, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x60, 0x30, 0x00, 0x00, 0x60, 0x60, 0x60, 0x60, 0x30, 0x30, 0x00, 0x00, 0x60, 0x60, 0x60, 0x30, 0x30, 0x20, 0x00, 0x00, 0x60, 0x60, 0x60, 0x30, 0x30, 0x01, 0xe0, 0x00, 0x60, 0x60, 0x60, 0x30, 0x30, 0x0f, 0xfc, 0x00, 0x60, 0x60, 0x60, 0x30, 0x30, 0x3f, 0xff, 0x00, 0x60, 0x60, 0x60, 0x30, 0x18, 0x78, 0x03, 0x80, 0x60, 0x60, 0x60, 0x30, 0x1c, 0x60, 0x01, 0x80, 0x60, 0x60, 0x30, 0x38, 0x0c, 0xc0, 0x00, 0xc0, 0x00, 0x60, 0x30, 0x18, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0x60, 0x30, 0x18, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xe0, 0x30, 0x0c, 0x01, 0xc0, 0x00, 0xe0, 0x00, 0xc0, 0x18, 0x0e, 0x01, 0xc0, 0x00, 0xe0, 0x60, 0xc0, 0x18, 0x07, 0x01, 0xc0, 0x00, 0xe0, 0x01, 0xc0, 0x1c, 0x03, 0x81, 0xc0, 0x00, 0xe0, 0x01, 0x80, 0x0c, 0x01, 0xc1, 0xc0, 0x00, 0xe0, 0x03, 0x80, 0x0e, 0x00, 0xf1, 0xc0, 0x00, 0xe0, 0x0f, 0x00, 0x06, 0x00, 0x01, 0xc0, 0x00, 0xe0, 0x3e, 0x01, 0x03, 0x00, 0x01, 0xc0, 0x00, 0xe0, 0x30, 0x03, 0x83, 0x80, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x03, 0x81, 0xc0, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x07, 0xc0, 0xe0, 0x30, 0x00, 0x00, 0x03, 0x00, 0x0e, 0xc0, 0x78, 0x30, 0x00, 0x00, 0x03, 0x00, 0x3c, 0x60, 0x1e, 0x30, 0x00, 0x00, 0x03, 0x00, 0x78, 0x70, 0x0f, 0x30, 0x00, 0x00, 0x03, 0x03, 0xe0, 0x38, 0x03, 0x30, 0x00, 0x00, 0x03, 0x07, 0x80, 0x1c, 0x00, 0x30, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x0f, 0x00, 0x30, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x03, 0x80, 0x30, 0x01, 0xe0, 0x03, 0x00, 0x18, 0x01, 0xe0, 0x30, 0x03, 0xf0, 0x03, 0x00, 0x18, 0x00, 0x7c, 0x30, 0x07, 0x38, 0x03, 0x00, 0x0c, 0x00, 0x1f, 0x30, 0x06, 0x18, 0x03, 0x18, 0x0e, 0x00, 0x07, 0x30, 0x06, 0x18, 0x03, 0x0c, 0x07, 0x80, 0x00, 0x30, 0x07, 0x38, 0x03, 0x0e, 0x03, 0xc0, 0x00, 0x30, 0x03, 0x30, 0x03, 0x07, 0x00, 0xf0, 0x00, 0x30, 0x03, 0x30, 0x03, 0x03, 0x00, 0x7e, 0x00, 0x30, 0x03, 0x30, 0x03, 0x01, 0x80, 0x1f, 0xc0, 0x30, 0x03, 0x30, 0x03, 0x01, 0xc0, 0x03, 0xe1, 0x30, 0x07, 0xf8, 0x03, 0x00, 0xf0, 0x00, 0x01, 0x30, 0x03, 0xf0, 0x03, 0x00, 0x38, 0x00, 0x00, 0x30, 0x00, 0x00, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x30, 0x00, 0x00, 0x03, 0x00, 0x07, 0xc0, 0x00, 0x30, 0x00, 0x00, 0x03, 0x00, 0x01, 0xff, 0x80, 0x3f, 0xff, 0xff, 0xff, 0x00, 0x00, 0x3f, 0x80, 0x1f, 0xff, 0xff, 0xfe
};
#define FinPr_scan_width 64
#define FinPr_scan_height 64
const uint8_t PROGMEM FinPr_scan_bits[] = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xfc, 0x7f, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1f, 0xfc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x38, 0x7f, 0xfe, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x78, 0xf8, 0x0f, 0x87, 0x00, 0x00, 0x00, 0x00, 0x71, 0xe0, 0x03, 0xc7, 0x00, 0x00, 0x00, 0x00, 0xe3, 0x80, 0x01, 0xc3, 0x80, 0x00, 0x00, 0x00, 0xc3, 0x83, 0xc0, 0xe3, 0x80, 0x00, 0x00, 0x00, 0xc7, 0x0f, 0xf0, 0x71, 0x80, 0x00, 0x00, 0x00, 0x06, 0x1f, 0xf8, 0x71, 0xc0, 0x00, 0x00, 0x00, 0x0e, 0x1c, 0x3c, 0x31, 0xc0, 0x00, 0x00, 0x00, 0x1c, 0x38, 0x1c, 0x31, 0xc0, 0x00, 0x00, 0x00, 0x38, 0x70, 0x0e, 0x39, 0xc0, 0x00, 0x00, 0x01, 0xf0, 0x71, 0x8e, 0x39, 0xc0, 0x00, 0x00, 0x03, 0xe0, 0xe1, 0x86, 0x31, 0xc0, 0x00, 0x00, 0x03, 0x81, 0xe3, 0x8e, 0x31, 0x80, 0x00, 0x00, 0x00, 0x03, 0xc3, 0x8e, 0x33, 0x80, 0x00, 0x00, 0x00, 0x07, 0x87, 0x0c, 0x73, 0x80, 0x00, 0x00, 0x00, 0x1f, 0x0e, 0x1c, 0x73, 0x80, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xf0, 0x1e, 0x3e, 0x1c, 0x00, 0x00, 0x00, 0x03, 0x80, 0x7c, 0x77, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0, 0xe3, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xe3, 0xc3, 0x81, 0xf0, 0x00, 0x00, 0x00, 0x3f, 0x87, 0x81, 0xc0, 0x60, 0x00, 0x00, 0x01, 0xfc, 0x1f, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x3c, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x78, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x07, 0xe0, 0xfc, 0x0f, 0xc0, 0x00, 0x00, 0x00, 0x3f, 0x83, 0xef, 0x03, 0xc0, 0x00, 0x00, 0x00, 0xfc, 0x0f, 0x87, 0x80, 0x00, 0x00, 0x00, 0x00, 0x70, 0x1f, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x01, 0xf0, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x03, 0xfe, 0x02, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0f, 0x8f, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x01, 0xe0, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0xc0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
void setup() {

  Serial.begin(9600);
  if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {  // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for (;;)
      ;  // Don't proceed, loop forever
  }

  display.display();
  delay(2000);  // Pause for 2 seconds
  display.clearDisplay();
  connectToWiFi();
  finger.begin(57600);
  Serial.println("\n\nAdafruit finger detect test");

  if (finger.verifyPassword()) {
    Serial.println("Found fingerprint sensor!");
    display.clearDisplay();
    display.drawBitmap(34, 0, FinPr_valid_bits, FinPr_valid_width, FinPr_valid_height, WHITE);
    display.display();
  } else {
    Serial.println("Did not find fingerprint sensor :(");
    display.clearDisplay();
    display.drawBitmap(32, 0, FinPr_failed_bits, FinPr_failed_width, FinPr_failed_height, WHITE);
    display.display();
    while (1) { delay(1); }
  }

  finger.getTemplateCount();
  Serial.print("Sensor contains ");
  Serial.print(finger.templateCount);
  Serial.println(" templates");
  Serial.println("Waiting for valid fingerprint...");
}

void loop() {

  //check if there's a connection to WiFi or not
  if (WiFi.status() != WL_CONNECTED) {
    connectToWiFi();
  }
  FingerID = getFingerprintID();
  delay(50);
  DisplayFingerprintID();
  ChecktoAddID();
  ChecktoDeleteID();
}
void DisplayFingerprintID() {
  if (FingerID > 0) {
    display.clearDisplay();
    display.drawBitmap(34, 0, FinPr_valid_bits, FinPr_valid_width, FinPr_valid_height, WHITE);
    display.display();

    SendFingerprintID(FingerID);
  } else if (FingerID == 0) {
    display.clearDisplay();
    display.drawBitmap(32, 0, FinPr_start_bits, FinPr_start_width, FinPr_start_height, WHITE);
    display.display();
  } else if (FingerID == -1) {
    display.clearDisplay();
    display.drawBitmap(34, 0, FinPr_invalid_bits, FinPr_invalid_width, FinPr_invalid_height, WHITE);
    display.display();
  }
  //---------------------------------------------
  //Didn't find the scanner or there an error
  else if (FingerID == -2) {
    display.clearDisplay();
    display.drawBitmap(32, 0, FinPr_failed_bits, FinPr_failed_width, FinPr_failed_height, WHITE);
    display.display();
  }
}
void SendFingerprintID(int finger) {

  WiFiClient client;
  HTTPClient http;
  postData = "FingerID=" + String(finger);
  http.begin(client, link);
  http.addHeader("Content-Type", "application/x-www-form-urlencoded");

  int httpCode = http.POST(postData);  //Send the request
  String payload = http.getString();   //Get the response payload

  Serial.println(httpCode);  //Print HTTP return code
  Serial.println(payload);   //Print request response payload
  Serial.println(postData);  //Post Data
  Serial.println(finger);    //Print fingerprint ID

  if (payload.substring(0, 5) == "login") {
    String user_name = payload.substring(5);
    //  Serial.println(user_name);

    display.clearDisplay();
    display.setTextSize(2);       // Normal 2:2 pixel scale
    display.setTextColor(WHITE);  // Draw white text
    display.setCursor(15, 0);     // Start at top-left corner
    display.print(F("Welcome"));
    display.setCursor(0, 20);
    display.print(user_name);
    display.display();
  } else if (payload.substring(0, 6) == "logout") {
    String user_name = payload.substring(6);
    //  Serial.println(user_name);

    display.clearDisplay();
    display.setTextSize(2);       // Normal 2:2 pixel scale
    display.setTextColor(WHITE);  // Draw white text
    display.setCursor(10, 0);     // Start at top-left corner
    display.print(F("Good Bye"));
    display.setCursor(0, 20);
    display.print(user_name);
    display.display();
  }
  delay(1000);

  postData = "";
  http.end();  //Close connection
}
//********************Get the Fingerprint ID******************
int getFingerprintID() {
  uint8_t p = finger.getImage();
  switch (p) {
    case FINGERPRINT_OK:
      //Serial.println("Image taken");
      break;
    case FINGERPRINT_NOFINGER:
      //Serial.println("No finger detected");
      return 0;
    case FINGERPRINT_PACKETRECIEVEERR:
      //Serial.println("Communication error");
      return -2;
    case FINGERPRINT_IMAGEFAIL:
      //Serial.println("Imaging error");
      return -2;
    default:
      //Serial.println("Unknown error");
      return -2;
  }
  // OK success!
  p = finger.image2Tz();
  switch (p) {
    case FINGERPRINT_OK:
      //Serial.println("Image converted");
      break;
    case FINGERPRINT_IMAGEMESS:
      //Serial.println("Image too messy");
      return -1;
    case FINGERPRINT_PACKETRECIEVEERR:
      //Serial.println("Communication error");
      return -2;
    case FINGERPRINT_FEATUREFAIL:
      //Serial.println("Could not find fingerprint features");
      return -2;
    case FINGERPRINT_INVALIDIMAGE:
      //Serial.println("Could not find fingerprint features");
      return -2;
    default:
      //Serial.println("Unknown error");
      return -2;
  }
  // OK converted!
  p = finger.fingerFastSearch();
  if (p == FINGERPRINT_OK) {
    //Serial.println("Found a print match!");
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    //Serial.println("Communication error");
    return -2;
  } else if (p == FINGERPRINT_NOTFOUND) {
    //Serial.println("Did not find a match");
    return -1;
  } else {
    //Serial.println("Unknown error");
    return -2;
  }
  // found a match!
  //Serial.print("Found ID #"); Serial.print(finger.fingerID);
  //Serial.print(" with confidence of "); Serial.println(finger.confidence);

  return finger.fingerID;
}
//******************Check if there a Fingerprint ID to delete******************
void ChecktoDeleteID() {

  WiFiClient client;
  HTTPClient http;  //Declare object of class HTTPClient
  //Post Data
  postData = "DeleteID=check";  // Add the Fingerprint ID to the Post array in order to send it
  // Post methode

  http.begin(client, link);                                             //initiate HTTP request, put your Website URL or Your Computer IP
  http.addHeader("Content-Type", "application/x-www-form-urlencoded");  //Specify content-type header

  int httpCode = http.POST(postData);  //Send the request
  String payload = http.getString();   //Get the response payload

  if (payload.substring(0, 6) == "del-id") {
    String del_id = payload.substring(6);
    Serial.println(del_id);
    deleteFingerprint(del_id.toInt());
  }

  http.end();  //Close connection
}
//******************Delete Finpgerprint ID*****************
uint8_t deleteFingerprint(int id) {
  uint8_t p = -1;

  p = finger.deleteModel(id);

  if (p == FINGERPRINT_OK) {
    //Serial.println("Deleted!");
    display.clearDisplay();
    display.setTextSize(2);       // Normal 2:2 pixel scale
    display.setTextColor(WHITE);  // Draw white text
    display.setCursor(0, 0);      // Start at top-left corner
    display.print(F("Deleted!\n"));
    display.display();
    return p;
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    //Serial.println("Communication error");
    display.clearDisplay();
    display.setTextSize(1);       // Normal 1:1 pixel scale
    display.setTextColor(WHITE);  // Draw white text
    display.setCursor(0, 0);      // Start at top-left corner
    display.print(F("Communication error!\n"));
    display.display();
    return p;
  } else if (p == FINGERPRINT_BADLOCATION) {
    //Serial.println("Could not delete in that location");
    display.clearDisplay();
    display.setTextSize(1);       // Normal 1:1 pixel scale
    display.setTextColor(WHITE);  // Draw white text
    display.setCursor(0, 0);      // Start at top-left corner
    display.print(F("Could not delete in that location!\n"));
    display.display();
    return p;
  } else if (p == FINGERPRINT_FLASHERR) {
    //Serial.println("Error writing to flash");
    display.clearDisplay();
    display.setTextSize(1);       // Normal 1:1 pixel scale
    display.setTextColor(WHITE);  // Draw white text
    display.setCursor(0, 0);      // Start at top-left corner
    display.print(F("Error writing to flash!\n"));
    display.display();
    return p;
  } else {
    //Serial.print("Unknown error: 0x"); Serial.println(p, HEX);
    display.clearDisplay();
    display.setTextSize(2);       // Normal 2:2 pixel scale
    display.setTextColor(WHITE);  // Draw white text
    display.setCursor(0, 0);      // Start at top-left corner
    display.print(F("Unknown error:\n"));
    display.display();
    return p;
  }
}
//******************Check if there a Fingerprint ID to add******************
void ChecktoAddID() {

  WiFiClient client;
  HTTPClient http;  //Declare object of class HTTPClient
  //Post Data
  postData = "Get_Fingerid=get_id";  // Add the Fingerprint ID to the Post array in order to send it
  // Post methode

  http.begin(client, link);                                             //initiate HTTP request, put your Website URL or Your Computer IP
  http.addHeader("Content-Type", "application/x-www-form-urlencoded");  //Specify content-type header

  int httpCode = http.POST(postData);  //Send the request
  String payload = http.getString();   //Get the response payload

  if (payload.substring(0, 6) == "add-id") {
    String add_id = payload.substring(6);
    Serial.println(add_id);
    id = add_id.toInt();
    getFingerprintEnroll();
  }
  http.end();  //Close connection
}
//******************Enroll a Finpgerprint ID*****************
uint8_t getFingerprintEnroll() {

  int p = -1;
  display.clearDisplay();
  display.drawBitmap(34, 0, FinPr_scan_bits, FinPr_scan_width, FinPr_scan_height, WHITE);
  display.display();
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
      case FINGERPRINT_OK:
        //Serial.println("Image taken");
        display.clearDisplay();
        display.drawBitmap(34, 0, FinPr_valid_bits, FinPr_valid_width, FinPr_valid_height, WHITE);
        display.display();
        break;
      case FINGERPRINT_NOFINGER:
        //Serial.println(".");
        display.setTextSize(1);       // Normal 2:2 pixel scale
        display.setTextColor(WHITE);  // Draw white text
        display.setCursor(0, 0);      // Start at top-left corner
        display.print(F("scanning"));
        display.display();
        break;
      case FINGERPRINT_PACKETRECIEVEERR:
        display.clearDisplay();
        display.drawBitmap(34, 0, FinPr_invalid_bits, FinPr_invalid_width, FinPr_invalid_height, WHITE);
        display.display();
        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:
      display.clearDisplay();
      display.drawBitmap(34, 0, FinPr_valid_bits, FinPr_valid_width, FinPr_valid_height, WHITE);
      display.display();
      break;
    case FINGERPRINT_IMAGEMESS:
      display.clearDisplay();
      display.drawBitmap(34, 0, FinPr_invalid_bits, FinPr_invalid_width, FinPr_invalid_height, WHITE);
      display.display();
      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;
  }
  display.clearDisplay();
  display.setTextSize(2);       // Normal 2:2 pixel scale
  display.setTextColor(WHITE);  // Draw white text
  display.setCursor(0, 0);      // Start at top-left corner
  display.print(F("Remove"));
  display.setCursor(0, 20);
  display.print(F("finger"));
  display.display();
  //Serial.println("Remove finger");
  delay(2000);
  p = 0;
  while (p != FINGERPRINT_NOFINGER) {
    p = finger.getImage();
  }
  Serial.print("ID ");
  Serial.println(id);
  p = -1;
  display.clearDisplay();
  display.drawBitmap(34, 0, FinPr_scan_bits, FinPr_scan_width, FinPr_scan_height, WHITE);
  display.display();
  while (p != FINGERPRINT_OK) {
    p = finger.getImage();
    switch (p) {
      case FINGERPRINT_OK:
        //Serial.println("Image taken");
        display.clearDisplay();
        display.drawBitmap(34, 0, FinPr_valid_bits, FinPr_valid_width, FinPr_valid_height, WHITE);
        display.display();
        break;
      case FINGERPRINT_NOFINGER:
        //Serial.println(".");
        display.setTextSize(1);       // Normal 2:2 pixel scale
        display.setTextColor(WHITE);  // Draw white text
        display.setCursor(0, 0);      // Start at top-left corner
        display.print(F("scanning"));
        display.display();
        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(2);
  switch (p) {
    case FINGERPRINT_OK:
      //Serial.println("Image converted");
      display.clearDisplay();
      display.drawBitmap(34, 0, FinPr_valid_bits, FinPr_valid_width, FinPr_valid_height, WHITE);
      display.display();
      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;
  }

  // OK converted!
  Serial.print("Creating model for #");
  Serial.println(id);

  p = finger.createModel();
  if (p == FINGERPRINT_OK) {
    //Serial.println("Prints matched!");
    display.clearDisplay();
    display.drawBitmap(34, 0, FinPr_valid_bits, FinPr_valid_width, FinPr_valid_height, WHITE);
    display.display();
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_ENROLLMISMATCH) {
    Serial.println("Fingerprints did not match");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }

  Serial.print("ID ");
  Serial.println(id);
  p = finger.storeModel(id);
  if (p == FINGERPRINT_OK) {
    //Serial.println("Stored!");
    display.clearDisplay();
    display.drawBitmap(34, 0, FinPr_valid_bits, FinPr_valid_width, FinPr_valid_height, WHITE);
    display.display();
    confirmAdding();
    return p;
  } else if (p == FINGERPRINT_PACKETRECIEVEERR) {
    Serial.println("Communication error");
    return p;
  } else if (p == FINGERPRINT_BADLOCATION) {
    Serial.println("Could not store in that location");
    return p;
  } else if (p == FINGERPRINT_FLASHERR) {
    Serial.println("Error writing to flash");
    return p;
  } else {
    Serial.println("Unknown error");
    return p;
  }
}
//******************Check if there a Fingerprint ID to add******************
void confirmAdding() {

  WiFiClient client;
  HTTPClient http;  //Declare object of class HTTPClient
  //Post Data
  postData = "confirm_id=" + String(id);  // Add the Fingerprint ID to the Post array in order to send it
  // Post methode

  http.begin(client, link);                                             //initiate HTTP request, put your Website URL or Your Computer IP
  http.addHeader("Content-Type", "application/x-www-form-urlencoded");  //Specify content-type header

  int httpCode = http.POST(postData);  //Send the request
  String payload = http.getString();   //Get the response payload

  display.clearDisplay();
  display.setTextSize(1.5);     // Normal 1:1 pixel scale
  display.setTextColor(WHITE);  // Draw white text
  display.setCursor(0, 0);      // Start at top-left corner
  display.print(payload);
  display.display();
  delay(1000);
  Serial.println(payload);

  http.end();  //Close connection
}
//********************connect to the WiFi******************
void connectToWiFi() {
  WiFi.mode(WIFI_OFF);  //Prevents reconnection issue (taking too long to connect)
  delay(1000);
  WiFi.mode(WIFI_STA);
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);

  display.clearDisplay();
  display.setTextSize(1);       // Normal 1:1 pixel scale
  display.setTextColor(WHITE);  // Draw white text
  display.setCursor(0, 0);      // Start at top-left corner
  display.print(F("Connecting to \n"));
  display.setCursor(0, 50);
  display.setTextSize(2);
  display.print(ssid);
  display.drawBitmap(73, 10, Wifi_start_bits, Wifi_start_width, Wifi_start_height, WHITE);
  display.display();

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.println("Connected");

  display.clearDisplay();
  display.setTextSize(2);       // Normal 1:1 pixel scale
  display.setTextColor(WHITE);  // Draw white text
  display.setCursor(8, 0);      // Start at top-left corner
  display.print(F("Connected \n"));
  display.drawBitmap(33, 15, Wifi_connected_bits, Wifi_connected_width, Wifi_connected_height, WHITE);
  display.display();

  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());  //IP address assigned to your ESP
}

Noted, I'll be looking into that. Thanks!

Update: I fixed it! I simply needed to set up my local server in order for my microcontroller and fingerprint scanner to enroll the fingerprints. Thanks to everyone's best of their knowledge in helping me out!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.