How do i combine two Arduino sketches?

First Arduino sketch:

#include<SoftwareSerial.h>
SoftwareSerial BT(10,11); // Connect Tx to pin 10 and Rx to pin 11 of HC-05/HC-06
String readData; // String for storing data send from the Bluetooth device

int Relay1=12;
int val1=0;

void setup()
{
BT.begin(9600);
Serial.begin(9600);
pinMode(Relay1,OUTPUT);

digitalWrite(Relay1,HIGH);
}

void loop()
{
while (BT.available())
{
delay(10);
char c=BT.read();
readData +=c;
}
if(readData.length()>0)
{
Serial.println(readData);

if (readData=="relay1")
{
val1=digitalRead(Relay1);
if(val1==0)
{
digitalWrite(Relay1,HIGH);
val1=1;
}
else
{
digitalWrite(Relay1,LOW);
val1=0;
}
delay(200);
}

readData="";
}

}

THIS PROGRAMME WILL THE DOOR UNLOCK VIA BLUETOOTH

Second Arduino sketch:

/***************************************************
This is an example sketch for our optical Fingerprint sensor

Designed specifically to work with the Adafruit BMP085 Breakout
----> Fingerprint sensor : ID 751 : $49.95 : Adafruit Industries, Unique & fun DIY electronics and kits

These displays use TTL Serial to communicate, 2 pins are required to
interface
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries.
BSD license, all text above must be included in any redistribution
****************************************************/

#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(11,OUTPUT);
// pinMode(12,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!
pinMode(12,OUTPUT);
if(finger.fingerID==1)
{
digitalWrite(12,LOW);
delay(1000);
digitalWrite(12,HIGH);

// if(finger.fingerId==2)
//{
// digitalWrite(13,HIGH);
// delay(1000)
}
Serial.print("Found ID #"); Serial.print(finger.fingerID);
Serial.print(" with confidence of "); Serial.println(finger.confidence);
return finger.fingerID;
}

THIS PROGRAMME WILL THE DOOR UNLOCK VIA FINGERPRINT SENSOR

PLEASE CHANGE TO ONE SKETCH AND SEND ME IN MY EMAIL : MIANISMAIL95@GMAIL.COM

IS THAT A REQUEST TO YOU OR US!!!!!!?????

Simple answer, you don't :slight_smile: You learn how to program (using examples and other programs) and then plan a project :slight_smile:

We can do that for you, simply post it in Gigs and collabs but do expect people to ask legal tender in return.

To make it easy for people to help you please modify your post and use the code button </>

so your code looks like this

and is easy to copy to a text editor. See How to use the Forum

This Simple Merge Demo may help get you started.

Before trying to merge the programs go through each of them carefully to make sure they are not trying to use the same resource - for example an I/O pin. If you find conflicts change something in one of the separate programs and make sure it still works with the change.

...R