NewSoftSerial not working for me anymore

Hi,

I have been struggling for a few days to read some serial info from an rs485 network, and I thought it was my ttl conversion chip setup that was not working properly, but I have tested with an ftdi cable and I get perfect readings. Why can I not read the same into the arduino?

The sketch I have been trying is based on the simple example, and simplified even more:

#include <NewSoftSerial.h>

NewSoftSerial mySerial(6, 7); //rx,tx

void setup()  
{
  Serial.begin(19200);
  Serial.println("Goodnight moon!");
  // set the data rate for the NewSoftSerial port
  mySerial.begin(19200);
}

void loop()                     // run over and over again
{

  if (mySerial.available()) {
      Serial.print((char)mySerial.read());
  }
}

It should read strings like:
41 00 00 00 DF 17 20 83 08 4F 6B C7 08 6B
(hex or not is not important at this stage, I'm trying to find the fault)
but instead it's dead silent.

Is there a reason why the library example used two different speeds for mySerial and Serial?

Joachim

I think your problem is that you are using the old AND new serial libraries. Try only using the NewSoftSerial functions (in your case, myserial.function().

Is there a reason why the library example used two different speeds for mySerial and Serial?

Yes. The example illustrates that it is not necessary that the two devices (whatever is connected to the NewSoftSerial TX and RX pins and whatever is connected to the hardware TX and RX pins (0 and 1)) communicate at the same speed. The data coming in on the software port comes in at one speed, and the data going out on the hardware serial port (or the other way around) can go out at a different speed.

Update:

I got it working again, by making the switch to 0022 and deleting and downloading the library again.

Joachim

Thank you for the follow-up.