I NEED HELP FOR SOFTWARE SERIAL

hi, i am using software serial library for my project and i’ve encountered some problem

#include <SoftwareSerial.h>

// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)
SoftwareSerial serial1(2,3); // RX, TX

void setup()
{
  serial1.begin(9600);
  Serial.begin(9600);
}

void loop()
{
  if(Serial.available())
  {
    serial1.write(Serial.read());
  
  }
  
  if(serial1.available())
  {
    Serial.write(serial1.read());
  }
}

i dont think my code have any problem… can someone helllppp me !!
thanks :slight_smile:

Why? SoftwareSerial is a library which allows you to create a virtual Serial port instead of using the Hardware Serial port of the Arduino. What Advantage do you perceive in using SoftwareSerial on Pins 2 and 3?

Other than that, if you want help with some Problem, it would help us to help you if you told us what Problem you Need help on. Are you encountering Errors? What do they say? Or is it simply not working?

Start with something more basic. The first test should only verify that the XBEE module connects successfully to some other station. See the examples, coming with the XBEE library.