two programs to one

hello and good morning !

i made 2 programs and they both work , but when i tryed to combine them it shows me "Error compiling for board Arduino/Genuino Uno."

when i dissable one of them the program is runnging good . i think its something with the serial ,
please help ! :frowning:

#include <SoftwareSerial.h>

int DIGITAL_SENSOR_PIN_1=1; // DATA LEGS
int DIGITAL_SENSOR_PIN_2=2;
int LEDPIN1 = 11; // OUT diode leg.
int LEDPIN2 = 12;

int switch_state_1;
int switch_state_2; // Holds the last digital value

const int RX1 = 2;
const int TX1 = 3;

const int RX2 = 4;
const int TX2 = 5;

const int RX3 = 6;
const int TX3 = 7;

SoftwareSerial PortOne (RX1,TX1); // RX and TX
SoftwareSerial PortTwo(RX2,TX2); // RX and TX
SoftwareSerial PortThree(RX3,TX3); // RX and TX

int i,x,y; //integer!
#define ledPin 15
void setup()
{
Serial.begin(9600); // start serial to PC
pinMode(RX1, INPUT); // set RX TO BE INPUT
pinMode(RX2, INPUT);
pinMode(RX3, INPUT);
pinMode(TX1, OUTPUT); /// SET TX to be output.
pinMode(TX2, OUTPUT);
pinMode(TX3, OUTPUT);

pinMode(DIGITAL_SENSOR_PIN_1, INPUT); // DATA LEGS input.
pinMode(DIGITAL_SENSOR_PIN_2, INPUT);
pinMode(LEDPIN1, OUTPUT); // DIODE OUTPUT
pinMode(LEDPIN2, OUTPUT);

}

void loop()
{
RFID();
LDR();

}

void LDR()
{

switch_state_1 = digitalRead(DIGITAL_SENSOR_PIN_1); // enter data of the thing to integer for if statment.

if(switch_state_1 == LOW) // if the data is low so the led is works
{
digitalWrite(LEDPIN1, HIGH);
}

else
{
digitalWrite(LEDPIN1, LOW); // else it doesnt work.
}

switch_state_2 = digitalRead(DIGITAL_SENSOR_PIN_2); // enter data of the thing to integer for if statment.

if(switch_state_2 == LOW)
{
digitalWrite(LEDPIN2, HIGH);
}

else
{
digitalWrite(LEDPIN2, LOW);
}
}

void RFID()
{
PortOne.begin(9600); // start commuinication with the first software
if (PortOne.available() > 0) //if the RF-D is geting "1" he write this in serial monitor and put 1
{
i = PortOne.read(); // get the info from the RFID
Serial.print(i, DEC);
Serial.print(" "); // prints it .
digitalWrite(15, HIGH); // get '1' in pin 15

}
PortOne.end(); // end communication on the first software

PortTwo.begin(9600); // start commuinication with the second software
if (PortTwo.available() > 0) //if the RFID is geting "1" he write this in serial monitor and put 1
{
x = PortTwo.read();
Serial.print(x, DEC);
Serial.print(" ");
digitalWrite(15, HIGH); // get '1' in pin 15

}

PortTwo.end(); // end communication on the first software

PortThree.begin(9600); // start commuinication with the third software
if (PortThree.available() > 0) //if the RFID is geting "1" he write this in serial monitor and put 1
{
y = PortThree.read();
Serial.print(y, DEC);
Serial.print(" ");
digitalWrite(15, HIGH); // get '1' in pin 15

}
PortThree.end(); // end communication on the third software

Your incorrectly posted code is incomplete.

Please post all the code using code tags

Purely from a compilation point of view, it's just missing a } on the very end.

  }
  PortThree.end(); // end communication on the third software

}  //<<<<<<<<<<<<<<<<< add this