[HELP] Fingerprint coding

Hi everyone.

I would like some help regarding my program. As you can see, my program is very long and messy so I tried making a new tab for functions. I can only get the simple functions to work.
But for the fingerprint codes, I'm not sure which lines to put in a new tab so my code is just a

fingerPrint ()

btw what im doing is

lcd screen display

place finger on the fingerprint sensor

servo locks the door

Also
the enrolling part was done separately on its own program. i also need help on how to combining the enroll and fingerprint codes together. so that another person can use it and input his own ID in 1 program rather than running Enroll followed by the Fingerprint, 2 different sketches.

i will be using a keypad to input the #id for the enroll part.

thanks for reading. hope to hear soon.

Finger_Servo_LCD_NO_FUNC.ino (4.4 KB)

so I tried making a new tab for functions. I can only get the simple functions to work.

A second tab means another file. Where is the other file? What extension did you give the file in the other tab?

What simple functions worked? Why didn't more complex ones work?

i also need help on how to combining the enroll and fingerprint codes together. so that another person can use it and input his own ID in 1 program rather than running Enroll followed by the Fingerprint, 2 different sketches.

i will be using a keypad to input the #id for the enroll part.

So, you've not defined the requirements for the combined program, nor have you made any attempt to figure out what parts of the two existing programs belong in the new program, nor have you made any attempt to get data from the keypad. Is that correct?

#if ARDUINO >= 100
SoftwareSerial mySerial(2, 3);
#else
NewSoftSerial mySerial(2, 3);
#endif

So, you have a mySerial attached to the two pins? What does a mySerial look like?

Servo myservo;  // create servo object to control a servo

Good thing you are not using someone else's servo. They might want it back, and then your project wouldn't work.

Is there some good reason for not using names that reflect the physical objects that are connected? scanner and doorLockServo for instance?

As you can see, my program is very long and messy

It's messy because you use names that make no sense.

It's messy because you switch between switch statements with cases and if/else if/else statements for no good reason.

It's messy because you change styles for no good reason. Either the { goes after the statement it goes with on the same line (yuck!) or it goes on the next line (my preference). It does NOT go one place sometimes and the other other times.

A function has ONE return statement, not 47.

The variable p means one thing, not 14 things.

  myservo.write(90);              // tell servo to go to position in variable 'pos' 
    delay(1000);                       // waits 15ms for the servo to reach the position

If you are going to have useless comments, you MUST keep them correct useless comments. Otherwise, you look like an idiot.

  getFingerprintIDez();

A function should do ONE thing. There is no reason for this function to be diddling with the servo. It should do EXACTLY what the name says - get the fingerprint ID. The return value should NOT be discarded. The loop() function should evaluate the return code and decide whether to move the servo, or not.

    delay(1000);

There is absolutely no excuse for this in loop().

omg i forgot about changing the comments. it was from the existing library and i forgot to take out the comments. im sorry about that!