FPM10A library problems

I'm doing my school final project with the fingerprint sensor FPM10A

The first code you posted is designed to work with a specific fingerprint scanner, but not that one.

I don't know which sensor the second code is designed to work with, but the fact that the code thinks the sensor is not attached suggests that the library is not designed to work with the sensor you have, or that you have not connected your sensor correctly.

It is impossible to tell from your picture if the wiring is correct. One simple test is to reverse the RX and TX wires. Perhaps your interpretation of transmit and receive directions does not match its.