Trying to convert GT-511CR Touch Sensor library from serial to serial1

I am trying to use this sensor: Sparkfun 5v TTL GT-511CR Fingerprint Scanner

But the problem is I need to use it with an Arduino Pro Micro, since the Pro Micro can be plugged into a PC to act as an HID-compliant keyboard. The reason this is a problem, is that the Pro Micro, like the Leonardo, "uses Serial1 to communicate via TTL (5V) serial on pins 0 (RX) and 1 (TX). Serial is reserved for USB CDC communication." (quoting the Arduino page on serial communication).

Normally the solution would be to use Serial1, but the fingerprint scanner library hides those "serial.command" things inside the .cpp file, but I can't figure out how many need to be changed to "serial1.command" to make it work. Trying to do so, it always messes up the library .cpp and no longer will verify.

On the other hand, I have been able to get this sensor working on the Arduino Uno, so I know I'm wiring everything correctly. It's just a matter of converting serial to serial1 in the correct places within the library for this sensor.

If somebody could take the existing serial library for this sensor, and convert it to be usable with the Leonardo / Pro Micro that require it to be on Serial1, I would definitely appreciate it. My attempts have ended in frustration.

... And then I plug things back in and stuff starts acting like it's working.

Well if I figure this out, I'll post how I did it!

To make the sensor work with an Arduino Pro Micro (or Leonardo):

Wire the sensor in the manner shown on this page, but wire the sensor TX to pin 9, and the sensor's RX (after the voltage divider) to pin 8.

Using the library example programs, change pins "4, 5" to "8, 9" and change only the first "serial.begin" to "serial1.begin", but do NOT change the "serial.print" lines to serial.1

Upload the sketch, wait for completion. Unplug the USB. Make sure to close any Serial Monitor you may have opened. Plug in the USB. Ensure the fingerprint scanner lights up blue. Open the serial monitor. Now you can see the feedback from whatever the program is. Some programs show nothing until you place a finger on to scan. You must enroll several fingers first (they save to the sensor itself). Then you may run the login sketch, and have it perform an action when the sensor sees a finger it knows and likes.

For my project, I have a successful fingerprint scan cause the Arduino Pro Micro to, via its USB connection to PC, send the ctrl+alt+del and then type in my password and hit enter. Since I have to lock my windows screen very often (at least a dozen times per workday), now I can just press a finger on the scanner to log in, instead of trying to remember what my weekly password is. It is easy enough to upload a new sketch with an updated password, but from a security standpoint, I believe even if somebody swiped this off my desk, so long as I encase the Arduino and sensor in an epoxy resin so they can't be taken apart (to swap the sensor to one with the thief's print saved as good), there is no way to get the password out of the Arduino. Unless the program can be offloaded, but I don't think it works that way. One way or another, this is secure and more convenient, and was a challenging and fun little project. I have attached copies of the example programs, altered with serial1.begin and pins "8, 9" and also showing how I have the finger scan trigger the keyboard login.

FPSBlink.ino (1.05 KB)

FPSEnroll.ino (2.1 KB)

FPSIDFinger.ino (1.37 KB)