Getting started with AltSoftSerial

I loaded the AltSoftSerial library via the library manager.

Test 1: Load the Echo sketch to a bare Arduino UNO and jump pins 8 and 9 (ie., the only thing attached is the USB cable and a single jumper). The serial monitor showed a echo. (when pins 8/9 were not jumped, then nothing happened). This seems to work as I expect.

Test 2: Load the Echo sketch on a second bare Arduino. I then connect Arduino 1 pin 8 to Arduino 2 pin 9 and Arduino 1 pin 9 to Arduino 2 pin 8 (in short, cross and connect the RX/TX lines). I moved the Arduino 2 to be connected to a Computer 2 and started the Arduino IDE serial monitor. I expected this to show on the Computer #2 serial monitor what I type on Computer #1 serial monitor, as well as the reverse. Well both computers show garbage on the serial monitor. Something is being transmitted (presumably what I typed due to test #1), but it does not seem to be getting received properly.

The sketch is the unmodified example, the arduinos are bare expect for USB and pin 8/9 TX/RX jumpers.

I do see the startup text from the example in the serial monitor as legible test. From there is down hill.

Thoughts? (ie., what am I missing?)

Are the grounds connected?

Success?

I complain to SWMBO about not using a real browser. I should heed my own advice. There was supposed to be a post in response to -dev that said "Nope. Doh." facepalm

Yes it works now, with the ground connected.

The original plan was to have both Arduinos connected to the same computer, but the IDE couldn't handle having two serial monitors open so I focused on getting setup on a second computer and completely missed the grounds no longer being connected.

Thanks all (and -dev).

Next thread. Modbus RTU over AltSoftSerial, direct connect of two devices at TTL level. One step at a time. I'll add the RS-485 modules and additional Arduinos later.

Until the next thread on this project. 8)

the IDE couldn't handle having two serial monitors open

You can use a different Terminal Emulator. Pick one and run two instances. Or use Serial Monitor from one IDE and use a Terminal Emulator for the other. PuTTY, minterm, Tera Term and xterm are common choices.

the IDE couldn't handle having two serial monitors open

Oh yes it can !

Open 2 instances of the IDE rather than opening one then doing File/New or File/Open

Behold, 2 copies of the IDE, each of which can use a different board type and COM port

UKHeliBob:
Oh yes it can !
Open 2 instances of the IDE rather than opening one then doing File/New or File/Open
Behold, 2 copies of the IDE, each of which can use a different board type and COM port

Let's get the steps down and investigate.

Double click on the Arduino IDE icon to open instance #1, then select the port (COM7) for Arduino #1 and upload the sketch then open the serial monitor.

-No problem so far. I'm online with the first instance and Arduino #1.

Double click on the Arduino IDE icon to open instance #2.

-OK. Arduino IDE instance #2 is open.

Change port to Arduino #2 (COM4).

-aah. Serial Monitor #1 closed. (That could be a problem)

Upload program to Arduino #2 and open the serial monitor.

-OK. Serial Monitor for instance #2 is open. I'm connected to Arduino #2.

Return to instance #1. Port has been changed to COM4, change back to COM7 and open the serial monitor for instance #1.

-Serial Monitor #2 closed and Serial Monitor #1 is open.

What is wrong or am I doing wrong?

My steps, which I just tried

Open the IDE by double clicking on its icon
It defaulted to :
Board : Uno
Port : COM 3
Open the Serial monitor on COM3

Open another instance of the IDE by double clicking on its icon
Same defaults
Change the board in this instance to WeMos D1 Mini
Change the port in this instance to COM8
Open the Serial monitor on COM8

Keep in mind I'm trying to test a TX/RX echo sketch, so I was loading the same sketch to both Arduinos.

Could it be due to using the same board and sketch for both instances? Unfortunately I tried something else (see below) and it didn't work as well.

I tried changing sketches for instance #1 in various places through the step I listed above. It did not make a difference. When I change the com port on the 'this' instance the instance on 'other' instance closes. Doesn't matter if I change port for board #1, then #2 closes or the reverse.

That seems to leave only having the same board (or something else that I don't know of yet). I will have to dig out the MEGA and give that a try.

No help, I am sure, but it works for me. I am using Windows 10, you ?

I had been using Windows 7. I can try Windows 10 later.

Sorry lads, been watching silently. Just hooked up two Uno (China clones), same PC, COM11 under 1.8.5, COM4 under 1.8.4, pin 8 to 9, pin 9 to 8, naked echo example, works just fine.

1.8.5
WARNING: Category '' in library ArduinoUnit is not valid. Setting to 'Uncategorized'
In file included from C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\examples\Echo\Echo.ino:1:0:

C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial/AltSoftSerial.h:63:24: warning: unused parameter 'rxPin' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial/AltSoftSerial.h:63:39: warning: unused parameter 'txPin' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

In file included from C:\Users\Watson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino/Arduino.h:24:0,

from sketch\Echo.ino.cpp:1:

C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial/AltSoftSerial.h:63:61: warning: unused parameter 'inverse' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

In file included from C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\examples\Echo\Echo.ino:1:0:

C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial/AltSoftSerial.h:68:33: warning: unused parameter 'enable' [-Wunused-parameter]

static void enable_timer0(bool enable) { }

^

In file included from C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\AltSoftSerial.cpp:31:0:

C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\AltSoftSerial.h:63:24: warning: unused parameter 'rxPin' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\AltSoftSerial.h:63:39: warning: unused parameter 'txPin' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

In file included from C:\Users\Watson\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.6.21\cores\arduino/Arduino.h:24:0,

from C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\AltSoftSerial.h:30,

from C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\AltSoftSerial.cpp:31:

C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\AltSoftSerial.h:63:61: warning: unused parameter 'inverse' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

In file included from C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\AltSoftSerial.cpp:31:0:

C:\Users\Watson\Documents\Arduino\libraries\AltSoftSerial\AltSoftSerial.h:68:33: warning: unused parameter 'enable' [-Wunused-parameter]

static void enable_timer0(bool enable) { }

^

Sketch uses 3136 bytes (9%) of program storage space. Maximum is 32256 bytes.
Global variables use 430 bytes (20%) of dynamic memory, leaving 1618 bytes for local variables. Maximum is 2048 bytes.

1.8.4
In file included from D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\examples\Echo\Echo.ino:1:0:

D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial/AltSoftSerial.h:63:24: warning: unused parameter 'rxPin' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial/AltSoftSerial.h:63:39: warning: unused parameter 'txPin' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

In file included from D:\Arduino_legacy\1.8.4\hardware\arduino\avr\cores\arduino/Arduino.h:24:0,

from sketch\Echo.ino.cpp:1:

D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial/AltSoftSerial.h:63:61: warning: unused parameter 'inverse' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

In file included from D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\examples\Echo\Echo.ino:1:0:

D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial/AltSoftSerial.h:68:33: warning: unused parameter 'enable' [-Wunused-parameter]

static void enable_timer0(bool enable) { }

^

In file included from D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\AltSoftSerial.cpp:31:0:

D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\AltSoftSerial.h:63:24: warning: unused parameter 'rxPin' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\AltSoftSerial.h:63:39: warning: unused parameter 'txPin' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

In file included from D:\Arduino_legacy\1.8.4\hardware\arduino\avr\cores\arduino/Arduino.h:24:0,

from D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\AltSoftSerial.h:30,

from D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\AltSoftSerial.cpp:31:

D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\AltSoftSerial.h:63:61: warning: unused parameter 'inverse' [-Wunused-parameter]

AltSoftSerial(uint8_t rxPin, uint8_t txPin, bool inverse = false) { }

^

In file included from D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\AltSoftSerial.cpp:31:0:

D:\Arduino_legacy\1.8.4\portable\sketchbook\libraries\AltSoftSerial\AltSoftSerial.h:68:33: warning: unused parameter 'enable' [-Wunused-parameter]

static void enable_timer0(bool enable) { }

^

Archiving built core (caching) in: C:\Users\Watson\AppData\Local\Temp\arduino_cache_56384\core\core_arduino_avr_uno_27d9e6a186b17564832ef3a6db994fc2.a
Sketch uses 3136 bytes (9%) of program storage space. Maximum is 32256 bytes.
Global variables use 430 bytes (20%) of dynamic memory, leaving 1618 bytes for local variables. Maximum is 2048 bytes.

I never had a problem compiling and uploading. First issue was a lack of common ground. New second issue is getting two serial monitor sessions running on different com ports. I'l have to do further trials later.

If you're looking for alternatives, I hacked softwareSerial some time ago as it is notorious for bogarting the interrupts, and split it into three sub-libraries (B, C and D) that operate only with the pins on the specific ports. This leaves the other two ports available for pin change interrupts that won't work with full-on softwareSerial. You can download these from my Github page. DKWatson (David K. Watson) · GitHub

DKWatson,
I created an issue and showed Paul how to fix the code to eliminate the unused parameter warnings.

--- bill

Cheers.