combine two codes GSM and BBLUETOOTH Module HELP

#define REMOTEXY_MODE__HARDSERIAL

#include <RemoteXY.h>

#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 9600

#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255, 1, 0, 0, 0, 20, 0, 8, 13, 0,
2, 0, 25, 19, 53, 22, 2, 26, 31, 31,
79, 78, 0, 79, 70, 70, 0
};

struct {

uint8_t switch_1;

uint8_t connect_flag;

} RemoteXY;
#pragma pack(pop)

#define PIN_SWITCH_1 13

void setup()
{
RemoteXY_Init ();

pinMode (PIN_SWITCH_1, OUTPUT);

}

void loop()
{
RemoteXY_Handler ();

digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1 == 0) ? LOW : HIGH);

}
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);

String incomingData;
String message = "";
int relay_pin = 2;

void setup()
{
Serial.begin(115200);
SIM900.begin(19200);

pinMode(relay_pin, OUTPUT);
digitalWrite(relay_pin, HIGH);

SIM900.print("AT+CMGF=1\r");
delay(100);

SIM900.print("AT+CNMI=2,2,0,0,0\r");
delay(100);
}

void loop()
{

receive_message();

if (incomingData.indexOf("off") >= 0)
{
digitalWrite(relay_pin, LOW);
message = "Motor is turned off";

send_message(message);
}

if (incomingData.indexOf("on") >= 0)
{
digitalWrite(relay_pin, HIGH);
message = "Motor is turned on";
off
send_message(message);
}
}

void receive_message()
{
if (SIM900.available() > 0)
{
incomingData = SIM900.readString();
Serial.print(incomingData);
delay(10);
}
}

void send_message(String message)
{
SIM900.println("AT+CMGF=1");
delay(100);
SIM900.println("AT+CMGS="+639355830460"");
delay(100);
SIM900.println(message);
delay(100);
SIM900.println((char)26);
delay(100);
SIM900.println();
delay(1000);
}

The cented text
has to be the
worst way in, like, ever
to display
a
sketch.
Rather use tags:
[code] sketch goes here [/code]

You have piss-poorly posted code A that does something. You have piss-poorly posted code B that does something. You have some completely unspecified requirements for a new program.

You can't realistically expect anyone to tell you how to write the new program.

karma++ for inventive posting though

Does this help?

void setup()
{
  setupA();
  setupB();
}

void loop()
{
  loopA();
  loopB();
}


#define REMOTEXY_MODE__HARDSERIAL

#include <RemoteXY.h>

#define REMOTEXY_SERIAL Serial
#define REMOTEXY_SERIAL_SPEED 9600

#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{
  255, 1, 0, 0, 0, 20, 0, 8, 13, 0,
  2, 0, 25, 19, 53, 22, 2, 26, 31, 31,
  79, 78, 0, 79, 70, 70, 0
};

struct
{
  uint8_t switch_1;
  uint8_t connect_flag;
} RemoteXY;

#pragma pack(pop)

#define PIN_SWITCH_1 13

void setupA()
{
  RemoteXY_Init ();
  pinMode (PIN_SWITCH_1, OUTPUT);
}

void loopA()
{
  RemoteXY_Handler ();
  digitalWrite(PIN_SWITCH_1, (RemoteXY.switch_1 == 0) ? LOW : HIGH);
}

#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);

String incomingData;
String message = "";
int relay_pin = 2;

void setupB()
{
  Serial.begin(115200);
  SIM900.begin(19200);

  pinMode(relay_pin, OUTPUT);
  digitalWrite(relay_pin, HIGH);


  SIM900.print("AT+CMGF=1\r");
  delay(100);

  SIM900.print("AT+CNMI=2,2,0,0,0\r");
  delay(100);
}

void loopB()
{
  receive_message();

  if (incomingData.indexOf("off") >= 0)
  {
    digitalWrite(relay_pin, LOW);
    message = "Motor is turned off";
    send_message(message);
  }

  if (incomingData.indexOf("on") >= 0)
  {
    digitalWrite(relay_pin, HIGH);
    message = "Motor is turned on";
    send_message(message);
  }
}

void receive_message()
{
  if (SIM900.available() > 0)
  {
    incomingData = SIM900.readString();
    Serial.print(incomingData);
    delay(10);
  }
}

void send_message(String message)
{
  SIM900.println("AT+CMGF=1");
  delay(100);
  SIM900.println("AT+CMGS=\"+639355830460\"");
  delay(100);
  SIM900.println(message);
  delay(100);
  SIM900.println((char)26);
  delay(100);
  SIM900.println();
  delay(1000);
}