Can anyone combine sketch for bluetooth Module HC05 and fingerprint sensor R307

i am working on a project where i could use bluetooth and fingerprint sensor to start my bike. i have individual programmes for both of them and i want to combine them and use them in a single arduino.

Here is the programme for Bluetooth :-

int ledPin2 = 2;
int ledPin3 = 3;
char state;

void setup() {

/* OUTPUT PINS */
pinMode(ledPin2,OUTPUT);
pinMode(ledPin3,OUTPUT);

/* SET OUTPUT PINS TO HIGH */
digitalWrite(ledPin2, HIGH);
digitalWrite(ledPin3, HIGH);

Serial.begin(9600);
}

void loop() {
/* put your main code here, to run repeatedly: */
if(Serial.available()>0){
state = Serial.read();

switch(state)
{
case 'A':
digitalWrite(ledPin2, LOW);
Serial.print("LED 2 ON");
break;
case 'a':
digitalWrite(ledPin2, HIGH);
Serial.print("LED 2 OFF");
break;
case 'B':
digitalWrite(ledPin3, LOW);
Serial.print("LED 3 ON");
break;
case 'b':
digitalWrite(ledPin3, HIGH);
Serial.print("LED 3 OFF");
break;
}
}
}

Here is the code for the fingerprint sensor:-

#include <Adafruit_Fingerprint.h>

// On Leonardo/Micro or others with hardware serial, use those! #0 is green wire, #1 is white
// uncomment this line:
// #define mySerial Serial1

// For UNO and others without hardware serial, we must use software serial...
// pin #2 is IN from sensor (GREEN wire)
// pin #3 is OUT from arduino (WHITE wire)
// comment these two lines if using hardware serial
#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3);

Adafruit_Fingerprint finger = Adafruit_Fingerprint(&mySerial);

void setup()
{
pinMode(8,OUTPUT);
Serial.begin(9600);
while (!Serial); // For Yun/Leo/Micro/Zero/...
delay(100);
Serial.println("\n\nAdafruit finger detect test");

// set the data rate for the sensor serial port
finger.begin(57600);

if (finger.verifyPassword()) {
Serial.println("Found fingerprint sensor!");
} else {
Serial.println("Did not find fingerprint sensor :(");
while (1) { delay(1); }
}

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

void loop() // run over and over again
{
getFingerprintIDez();
delay(50); //don't ned to run this at full speed.
}

uint8_t 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 p;
case FINGERPRINT_PACKETRECIEVEERR:
Serial.println("Communication error");
return p;
case FINGERPRINT_IMAGEFAIL:
Serial.println("Imaging error");
return p;
default:
Serial.println("Unknown error");
return p;
}

// OK success!

p = finger.image2Tz();
switch (p) {
case FINGERPRINT_OK:
Serial.println("Image converted");
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!
p = finger.fingerFastSearch();
if (p == FINGERPRINT_OK) {
Serial.println("Found a print match!");
} else if (p == FINGERPRINT_PACKETRECIEVEERR) {
Serial.println("Communication error");
return p;
} else if (p == FINGERPRINT_NOTFOUND) {
Serial.println("Did not find a match");
return p;
} else {
Serial.println("Unknown error");
return p;
}

// found a match!
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);

return finger.fingerID;
}

// returns -1 if failed, otherwise returns ID #
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;

// found a match!
if(finger.fingerID>=1)
{
digitalWrite(8,HIGH);
delay(1000);
digitalWrite(8,LOW);

}
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}

please help me with this....

which arduino board u r using.?

Arduino Uno

i am using adafruit fingerprint library

Adafruit_Fingerprint_Sensor_Library.zip (1.62 MB)

What do you intend the Bluetooth to talk to? And wahat is the finger code actually talking to now? The Bluetooth code you present seems hardly relevant, and may be best dispensed with. You already have serial commands in Fingerprint code and, assuming the finger device is doing what it is supposed to do, it seems that all you need do is connect bluetooth to serial, pins 0,1, and you are off and away.