NewSoftSerial doesn't work

Hi everybody!!!! I try to communicate the arduino with a PC trough RS-232 using a MAX232 circuit. Te 232 circuit works good, but I try to use other lines different from (0, 1) // (rx, tx) and it doesn't work (nothing is received). Of course, (0, 1) lines work good!!!
The program is very simple, I want to use more than one serial line, so I must use other lines different from (0, 1).

Has someone any idea???

Thanks and greetings!!!

#include <NewSoftSerial.h>

NewSoftSerial mySerial(0, 1); // (rxpin, txpin)
// (empty) also works, but (1, 0), (2, 3), (2, 4)... doesn't!!!

void setup()
{
Serial.begin(9600);
pinMode(13, OUTPUT); // sets the digital pin as output
}

void loop()
{
Serial.println("Hello, world");
digitalWrite(13,HIGH);
delay(1000);
}

You are not calling NSS anywhere. Serial.println() is a call to hardware serial.

You want to use mySerial.println(), etc.

-j

Thanks for your help, I changed the code, but still doesn't work!!!

#include <NewSoftSerial.h>

NewSoftSerial mySerial(2, 3); // (rxpin, txpin)

void setup()
{
mySerial.begin(9600);
pinMode(13, OUTPUT); // sets the digital pin as output
}

void loop()
{
mySerial.println("Hello, world");

digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}

That code looks fine now. My guess is that you are hooking RX to RX and TX to TX. It should be TX to RX and RX to TX. Whatever you initially connected to pin 0, now connect it to pin 2.

Mikal

Thanks very much for your answer, you gave me an idea.... Your guess was wrong, I tried changing the lines, but It's the same, but I changed lines in a different way and it seems to work. Now I'm using " NewSoftSerial mySerial(2, 3); // (rxpin, txpin)" but lines connected are (0, 3) and it works!!!!! both lines must be connected, if not it doesn't work. I tried now programming "NewSoftSerial mySerial(4, 3); // (rxpin, txpin)" but lines are still (0, 3) and it still works!!!! so the defined RX line is not working, always is the hardware RX line (pin 0). I tried "NewSoftSerial mySerial(4, 5); // (rxpin, txpin)" and it works on lines (0, 5), so the TX line is working good. Now I only need that the Rx line works good, but with this facts I think is a library problem and I don't know how to fix it!!!

Thanks very much for your help!!!

I also tried doing "NewSoftSerial mySerial = NewSoftSerial(4, 5);" but still the same...

Greetings!!!

I think is a library problem and I don't know how to fix it!!!

Sorry, but this sounds like a hardware issue to me. NSS works just fine for lots of people.

Maybe you should describe your hardware, preferably with an accurate schematic.

-j

Did you remember to connect the ground from the device to the arduino?

Hi. The 232 scheme is simple, I used it several times with XBee and Linksys WRT54G and works ok. Maybe is not the library but is the arduino board, I have another one, I will try with it.

The ground is connected to the arduino, the 232 circuit and to the RS-232 DB9.

Greetings!!

I tried with the other arduino board that I have and it works perfectly!!! I don't know what happens to the first board... but thanks to everybody that helped me!!!!

Greetings!!