SoftwareSerialExample appears not to work

The hardware serial communication appears to work fine. I get the “Goodnight moon!” and can type in the serial monitor and see the result echoed. When I change the baud rate to 4800 I get garbage and the Uno appear to neither recognize an input or output a string. “Hello, world!” never appears. I am on a Mac if that is significant. Any suggestions?

What are you connecting to?

That example sends "Goodnight Moon!" through Arduino USB, but "Hello world" uses a new serial port created in pins 2 (Arduino Rx of new serial port) and 3 (Arduino Tx of new serial port).

If you have just changed baudrate of computer, you are in the same port, so you continue receiving "Goodnight Moon!" message (you can't see it due to the different baudrate).

If you want to connect to the new serial port, you have to connect a RS232 driver to pins 2 and 3 and connect it to the serial port of the computer.

Thank you for your responses. I had the mistaken notion that the serial monitor could somehow see the transactions on pins 2 and 3. I now see how it works.

Sadly, the sample program to illustrate the SoftwareSerial library is totally useless without some sort of instructions as to how to observe it in operation. It seems to require a second computer (or at least a second monitor instance) connected to a serial port, along with a shield for interconnection.

Thanks jorgepl for your explanation. It answers a lot :blush:

Sadly, the sample program to illustrate the SoftwareSerial library is totally useless without some sort of instructions as to how to observe it in operation. It seems to require a second computer (or at least a second monitor instance) connected to a serial port, along with a shield for interconnection.

It's intended function is to read data from another serial device, like a GPS (connected to the software serial pins) and send that data to the hardware serial port, that the PC is connected to.

That you don't understand the situations where it is intended to be used is no reason to criticize the effort that others expended to create the library and example.