SoftwareSerial Library

Hi all,

I have a very simple piece of code for Arduino Uno. Using SoftwareSerial lib.

#include <SoftwareSerial.h>
#define rxPin 6
#define txPin 7
SoftwareSerial mySerial(rxPin, txPin);

void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.println(“Serial init”);

void loop() {
Serial.println(“Serial link started”);


if(mySerial.available() ){
int incomingByte =;
Serial.print(" is here");

rxPin and txPin are connected directly to each other. Arduino is also connected to PC throught USB. I have no respone from mySerial.available() loop, returns -1. Does anyone know, where could be the problem? SoftwareSerial doesnt work for me.

You can't do a loop-back with SoftwareSerial. It cannot talk and listen at the same time.