Arduino Nano Soft serial interface problem

Dear friends

Recently i have started working on Arduino Nano, my code is below , i un able to transmit & get the data on "soft serial "

Does soft serial work for Arduino Nano? Please let me know friends

//************
#include <SoftwareSerial.h>
SoftwareSerial mySerial = SoftwareSerial(10, 11);
// D6, D7 on board
void setup()
{
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println(“Goodnight moon!”); // it is printing on Serial monitor teminal
mySerial.begin(9600);
}

void loop()
{
mySerial.write(‘H’); // soft sending
char read_char = mySerial.read(); // soft reading
if(read_char == ‘H’) // comparing soft read data
{
Serial.println(“Soft Serial is Working”); // it has to print on soft terminal
}
delay(1000);
}

Hi sreenivas

SoftwareSerial mySerial =  SoftwareSerial(10, 11);
// D6, D7 on board

I'm confused by the comment. On the Nano board, what are the labels by the pins you are using for SoftwareSerial?

Regards

Ray

What are you trying to talk to?

Hackscribble: Hi sreenivas

SoftwareSerial mySerial =  SoftwareSerial(10, 11);
// D6, D7 on board

I'm confused by the comment. On the Nano board, what are the labels by the pins you are using for SoftwareSerial?

Regards

Ray

Dear Ray, Pins (10,11) = PD6, PD7 (of MCU) = D6,D7 (Marked on Nano board). when i short / join them (D6,D7) , Code should print "Soft Serial is Working" on Serial Monitor. Let me know whats wrong in my process.

PaulS:
What are you trying to talk to?

Dear Paul,
Sorry i did not mentioned the problem,

when i short / join them D6, D7 ( MCU pins 10,11 ), Code should print “Soft Serial is Working” on Serial Monitor.
but its not. i observed read char is getting the value (-1).

If you are using digital pins 6 and 7 of Nano, try 6 and 7 in SoftwareSerial statement.

Hackscribble:
If you are using digital pins 6 and 7 of Nano, try 6 and 7 in SoftwareSerial statement.

Dear friend
i tried as below , even though its not working as i expected

i am using
IDE : Arduino 1.0.5-r2
Hardware: Arduino Nano

Let me know any modifications to be done

//**************************************************************************
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10,11);

// Trial 1
// shorted D6, D7, output on serial monitor is
// Goodnoght moon!
// -1A-1A-1A

// Trial 2
// shorted D10, D11, output on serial monitor is
// Goodnoght moon!
// -1A-1A-1A
//(same output in both the cases)

void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
Serial.println(“Goodnight moon!”);
}

void loop()
{
mySerial.print(‘H’); // Soft serial print
Serial.print(mySerial.read());// Hard serial print after reading soft serial byte, here its printing “-1”
Serial.print(‘A’); //Hard serial print “A”

mySerial.print(‘H’); // soft serial print
char read_char = mySerial.read();// pushing into variable after soft reading
delay(1000); // wait for 1 second

if(read_char == ‘H’) // if soft serial read byte = H
{
Serial.println(“Soft Serial is Working”); // hard serail prints
}
}

Try changing this

SoftwareSerial mySerial(10,11);

to this

SoftwareSerial mySerial(6, 7);

Hackscribble: Try changing this

SoftwareSerial mySerial(10,11);

to this

SoftwareSerial mySerial(6, 7);

Thanks for the support, But its not working. tried SoftwareSerial mySerial(6, 7)

Trial 3 shorted D10, D11

Trial 4 Shorted D6,D7

output is same as previous : -1A-1A-1A-1A .....

Hi sreenivas

I should have realised this sooner, but you cannot send and receive [u]simultaneously[/u] with SoftwareSerial. So your loop test will miss the data sent.

There is information on this page:

https://code.google.com/p/arduino/issues/detail?id=1111

As PaulS asked, how do you want to use SoftwareSerial in practice? What is the Nano talking to? I assume the loop test was just to try out SoftwareSerial?

Regards

Ray

Hackscribble: Hi sreenivas

I should have realised this sooner, but you cannot send and receive [u]simultaneously[/u] with SoftwareSerial. So your loop test will miss the data sent.

There is information on this page:

https://code.google.com/p/arduino/issues/detail?id=1111

As PaulS asked, how do you want to use SoftwareSerial in practice? What is the Nano talking to? I assume the loop test was just to try out SoftwareSerial?

Regards

Ray

Thanks friends for your support.... I planned to use hard serial for for machine (which has UART) & soft serial for printer.

soft serial for printer

That should be one direction only (assuming no flow control characters back from the printer)? In which case, should work OK.