determing the softwareserial that is used

Hello,

I have done some search about basic information for SoftwareSerial. Now I'm confused.
I'm using Arduino-IDE Version 1.8.10. Some pages mention since IDE-Version 1.x NewSoftSerial is the new SoftSerial. With the library-manager I have installed another Serial Library called ESPSoftwareSerial.
Because I'm coding for a WeMos D1-Mini ESP8266-Board.

How can I determine which library is used if I code something like

#include <SoftwareSerial.h>

best regards

Stefan

StefanL38:
How can I determine which library is used if I code something like

Do this:

  • File > Preferences
  • Check the box next to "Show verbose output during: compilation".
  • Click the "OK" button.
  • Compile a sketch that contains the #include directive for the library.

After the compilation finishes, examine the contents of the black console pane in the Arduino IDE window. Near the bottom of the output, you will see something like this:

Using library SoftwareSerial at version 1.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.2\libraries\SoftwareSerial

Note that the library that gets used may depend on which board you have selected from the Tools > Board menu

The SoftwareSerial library is architecture specific, so the platform for each microcontroller architecture provides its own version of the SoftwareSerial library. In the example above, I had Tools > Board > Arduino Uno selected, so the SoftwareSerial library bundled with the Arduino AVR Boards platform was used. If I select Tools > Board > LOLIN(WEMOS) D1 R2 & mini, the output shows:

Using library SoftwareSerial at version 6.4.0 in folder: C:\Users\per\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.6.3\libraries\SoftwareSerial

so you can see the version of the library bundled with the ESP8266 core for Arduino platform was used this time.

You might not notice that a different library is being used from one board to another because the authors of these libraries will generally design them so the interface is the same, even though the source code behind that interface may be very different.

StefanL38:
Some pages mention since IDE-Version 1.x NewSoftSerial is the new SoftSerial.

That information only applies when you are using a board of the AVR architecture (e.g., Uno, Nano, Leonardo, Mega). Back in the days when that information was written, all Arduino boards were of the AVR architecture, so people didn't bother to specify which architecture they were talking about. Now, we have support for dozens of architectures.

StefanL38:
With the library-manager I have installed another Serial Library called ESPSoftwareSerial.
Because I'm coding for a WeMos D1-Mini ESP8266-Board.

That's not necessary. That library comes pre-installed with your installation of ESP8266 core for Arduino.

I should add that, although it is useful in some instances such as this one, I recommend that you generally leave the "Show verbose output during: compilation" option unchecked. The reason is that it adds a tremendous amount of text to the output which is generally not very useful. This extra text makes it hard to see the useful information in the output, such as warnings (make sure to turn on warnings in File > Preferences). When you need to post output to the forum to get help, the extra text also makes it more likely that it will exceed the forum's 9000 character limit.

On the other hand, I recommend always having "Show verbose output during: upload" on. It doesn't add too much extra text to the output and it's really nice to have some feedback on the upload progress.