user68788: I did a project with an Arduino Leonardo and a fingerprint sensor (DY50).
When I uploaded the enroll example from the Adafruit Fingerprint Library and saved my fingerprint, everything worked. But when I upload my code, it doesn't print anything.
My Code
#include <Keyboard.h>
#include <Adafruit_Fingerprint.h>
#define mySerial Serial1

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);
int fingerprintID = 0;
String inData;
bool isRight;
int pos;

//Number of services to log in
#define servNum 5

//Login URLs for Google, Amazon, Stackoverflow, Arduino and Github
String LogInURL[] = {"https://accounts.google.com/signin", "https://www.amazon.de/ap/signin", "https://stackoverflow.com/users/login", "https://login.arduino.cc/", "https://github.com/login"};
String LogInUser[] = {"user.name@gmail.com", "user.name@example.com", "user.name@example.com", "username", "username"};
String LogInPwd[] = {"password", "password", "password", "password", "password"};

void donothing() {};

void StepsBefore(int serviceNum){
  switch(serviceNum){
    case 0: donothing(); break;
    case 1: donothing(); break;
    case 2: for(int k=0; k<18; k++) Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    case 3: for(int k=0; k<2; k++) Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    case 4: donothing(); break;
    default: Serial.println("Error: Number not recognized."); break;
  }
}

void StepsAfter(int serviceNum){
  switch(serviceNum){
    case 0: Keyboard.println(); break;
    case 1: Keyboard.println(); break;
    case 2: Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    case 3: Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    case 4: for(int k=0; k<2; k++) Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    default: Serial.println("Error: Number not recognized."); break;
  }
}

int getFingerprintIDez() {
  uint8_t p = finger.getImage();
  if (p != FINGERPRINT_OK)  return -1;
  p = finger.image2Tz();
  if (p != FINGERPRINT_OK)  return -1;
  p = finger.fingerFastSearch();
  if (p != FINGERPRINT_OK)  return -1;
  Serial.print("Found ID #"); 
  Serial.print(finger.fingerID); 
  Serial.print(" with confidence of "); 
  Serial.println(finger.confidence);
  return finger.fingerID; 
}

void askForFingerprint() {
  fingerprintID = getFingerprintIDez();
    delay(50);
    if(fingerprintID == 1){
      isRight = true;
    }
}

void delAfterChar(String inString, String fromToKill){
  pos = inString.indexOf(fromToKill);
  inString.remove(pos, 1000);
  inData = inString;
}

void setup() {
    Serial.begin(115200);
    Serial.println("Debug 1");
    Keyboard.begin();
    Serial.println("Debug 2");
    finger.begin(57600);
    Serial.println("Debug 3");
    if(finger.verifyPassword()) {
        Serial.println("Found fingerprint sensor!");
    } 
    else {
        Serial.println("Did not find fingerprint sensor :(");
        while (1) { delay(1); }
    }
}
void loop() {
  inData = Serial.read();
  delAfterChar(inData, "?openid"); //Amazon
  delAfterChar(inData, "/v2/"); //Google
  delAfterChar(inData, "?ssrc"); //Stackoverflow
  delAfterChar(inData, "login?state"); //Arduino
    for (int i=0; i<servNum; i++){
     if(inData == LogInURL[i]){
        askForFingerprint();
        if(isRight == true){
           StepsBefore(i);
           Keyboard.print(LogInUser[i]);
           StepsAfter(i);
           Keyboard.println(LogInPwd[i]);
        }
        else Serial.println("Finger not recognized");
     }
    }
}

What I've tried so far

I changed the baud rate from 9600 to 15200, didn't help
Added a few debug points in the setup to check for an error there, nothing changed
Uploaded a simple Hello World via Serial Monitor sketch, worked perfectly

Question
What could be the issue? It compiles with no error message. If you see any coding mistakes, feedback would be great.

EDIT
Using SoftwareSerial instead didn't help either.

user68788: As @Juraj pointed out, I just forgot to use while (!Serial) in the setup, probably because I use other boards that don't need this more often.

68788: <p>I did a project with an Arduino Leonardo and a fingerprint sensor (DY50).
When I uploaded the <code>enroll</code> example from the <code>Adafruit Fingerprint Library</code> and saved my fingerprint, everything worked. But when I upload my code, it doesn't print anything.</p>
<p><strong>My Code</strong></p>
<pre><code>#include &lt;Keyboard.h&gt;
#include &lt;Adafruit_Fingerprint.h&gt;
#define mySerial Serial1

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&amp;mySerial);
int fingerprintID = 0;
String inData;
bool isRight;
int pos;

//Number of services to log in
#define servNum 5

//Login URLs for Google, Amazon, Stackoverflow, Arduino and Github
String LogInURL[] = {&quot;https://accounts.google.com/signin&quot;, &quot;https://www.amazon.de/ap/signin&quot;, &quot;https://stackoverflow.com/users/login&quot;, &quot;https://login.arduino.cc/&quot;, &quot;https://github.com/login&quot;};
String LogInUser[] = {&quot;user.name@gmail.com&quot;, &quot;user.name@example.com&quot;, &quot;user.name@example.com&quot;, &quot;username&quot;, &quot;username&quot;};
String LogInPwd[] = {&quot;password&quot;, &quot;password&quot;, &quot;password&quot;, &quot;password&quot;, &quot;password&quot;};

void donothing() {};

void StepsBefore(int serviceNum){
  switch(serviceNum){
    case 0: donothing(); break;
    case 1: donothing(); break;
    case 2: for(int k=0; k&lt;18; k++) Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    case 3: for(int k=0; k&lt;2; k++) Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    case 4: donothing(); break;
    default: Serial.println(&quot;Error: Number not recognized.&quot;); break;
  }
}

void StepsAfter(int serviceNum){
  switch(serviceNum){
    case 0: Keyboard.println(); break;
    case 1: Keyboard.println(); break;
    case 2: Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    case 3: Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    case 4: for(int k=0; k&lt;2; k++) Keyboard.press(KEY_TAB); Keyboard.release(KEY_TAB); break;
    default: Serial.println(&quot;Error: Number not recognized.&quot;); break;
  }
}

int getFingerprintIDez() {
  uint8_t p = finger.getImage();
  if (p != FINGERPRINT_OK)  return -1;
  p = finger.image2Tz();
  if (p != FINGERPRINT_OK)  return -1;
  p = finger.fingerFastSearch();
  if (p != FINGERPRINT_OK)  return -1;
  Serial.print(&quot;Found ID #&quot;); 
  Serial.print(finger.fingerID); 
  Serial.print(&quot; with confidence of &quot;); 
  Serial.println(finger.confidence);
  return finger.fingerID; 
}

void askForFingerprint() {
  fingerprintID = getFingerprintIDez();
    delay(50);
    if(fingerprintID == 1){
      isRight = true;
    }
}

void delAfterChar(String inString, String fromToKill){
  pos = inString.indexOf(fromToKill);
  inString.remove(pos, 1000);
  inData = inString;
}

void setup() {
    Serial.begin(115200);
    Serial.println(&quot;Debug 1&quot;);
    Keyboard.begin();
    Serial.println(&quot;Debug 2&quot;);
    finger.begin(57600);
    Serial.println(&quot;Debug 3&quot;);
    if(finger.verifyPassword()) {
        Serial.println(&quot;Found fingerprint sensor!&quot;);
    } 
    else {
        Serial.println(&quot;Did not find fingerprint sensor :(&quot;);
        while (1) { delay(1); }
    }
}
void loop() {
  inData = Serial.read();
  delAfterChar(inData, &quot;?openid&quot;); //Amazon
  delAfterChar(inData, &quot;/v2/&quot;); //Google
  delAfterChar(inData, &quot;?ssrc&quot;); //Stackoverflow
  delAfterChar(inData, &quot;login?state&quot;); //Arduino
    for (int i=0; i&lt;servNum; i++){
     if(inData == LogInURL[i]){
        askForFingerprint();
        if(isRight == true){
           StepsBefore(i);
           Keyboard.print(LogInUser[i]);
           StepsAfter(i);
           Keyboard.println(LogInPwd[i]);
        }
        else Serial.println(&quot;Finger not recognized&quot;);
     }
    }
}
</code></pre>
<p><strong>What I've tried so far</strong></p>
<ul>
<li>I changed the baud rate from <code>9600</code> to <code>15200</code>, didn't help</li>
<li>Added a few debug points in the <code>setup</code> to check for an error there, nothing changed</li>
<li>Uploaded a simple Hello World via Serial Monitor sketch, worked perfectly</li>
</ul>
<p><strong>Question</strong><br>
What could be the issue? It compiles with no error message. If you see any coding mistakes, feedback would be great.
<br><br>
<strong>EDIT</strong><br>
Using <code>SoftwareSerial</code> instead didn't help either.</p>
 68788: <p>As @Juraj pointed out, I just forgot to use <code>while (!Serial)</code> in the <code>setup</code>, probably because I use other boards that don't need this more often.</p>
