tx and rx among two channels same seriali arduino rev 3

I have tried to write a software that transmits and it receives, by serial, in the same card of arduino one.
I have connected the Pin RXpin 4 (first serial channel) with TXpin1 5 (second serial channel) and TXpin 3 (first serial channel) with RXpin1 6 (second serial channel)
Obviously doesn’t work!


#include <SoftwareSerial.h>
#define RXpin 4 // first serial channel
#define TXpin 3 // first serial channel
#define RXpin1 6 // second serial channel
#define TXpin1 5 // second serial channel

SoftwareSerial myPort = SoftwareSerial(RXpin, TXpin);
SoftwareSerial myPort1 = SoftwareSerial(RXpin1, TXpin1);
void setup()
Serial.println("Hello world ");
pinMode(RXpin, INPUT);
pinMode(TXpin, OUTPUT);
pinMode(RXpin1, INPUT);
pinMode(TXpin1, OUTPUT);

void loop()

char c;


// check if there are received characters
while (myPort1.available() > 0) {
c = myPort1.read();

thanks of the support and you excuse for mine “English”.

Hi, welcome to the forum.

There is no need to set the software TX or RX pins as input or output. That will be set in the SoftwareSerial.begin() function. As you can see in the examples : http://www.arduino.cc/en/Reference/SoftwareSerial

When two or more SoftwareSerial ports are created, only one RX can be active. The active receiver is selected with the listen() function.

There Arduino Mega 2560 board has 3 spare hardware serial ports.

Not only can only one instance of SoftwareSerial listen at a time, that instance doesn't listen while it is sending.

You can NOT use two SoftwareSerial instances the way you are trying to.