Go Down

Topic: NewSoftSerial not working for me anymore (Read 2187 times) previous topic - next topic

sy kristina


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:
Code: [Select]
#include <NewSoftSerial.h>

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

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

void loop()                     // run over and over again

 if (mySerial.available()) {

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?



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.

sy kristina


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


Coding Badly

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131