Why I can't find the SoftwareSerial library.And how to use the SomeSerial lib???

Below is my program .
I can't find the softwareSerial library ,so I got this SomeSerial lbrary.
But the compiler says that "No matching function for call to "SomeSerial::SomeSerial(int,int)!"

Can some one tells me how to use this SomeSerial with the SoftwareSerial issue....Thanks.

#include <SomeSerial.h>

// arm boards and esp32 do not support SoftwareSerial
SomeSerial mySoftSerial1(8, 9); // RX, TX
//SoftwareSerial mySoftwareSerial(10, 11); //RX, TX
//SomeSerial someSerial(&mySoftwareSerial);

//SomeSerial mySoftSerial1(&SerialUSB); // RX, TX

void setup() {
mySoftSerial1.begin(19200);
}

int proximity = 0;
int r = 0, g = 0, b = 0;
unsigned long lastUpdate = 0;

void loop() {
testPrintWithSomeSerial(&mySoftSerial1);
delay(3000);
}

void testPrintWithSomeSerial(SomeSerial* someSerial) {
someSerial->print("## start some serial at ");
someSerial->println(millis());
if (someSerial->isSoftwareSerial()) {
someSerial->println("It is SoftwareSerial");
someSerial->thisSoftwareSerial->println("Direct print to SoftwareSerial");
}
someSerial->println("## end some serial");
}

I can't find the softwareSerial library

It is built in with the IDE.
Please use </> code tags to post your code.

1 Like

Because of having architecture-specific low level code, the SoftwareSerial library is a platform bundled library. Platform bundled libraries are part of an Arduino boards platform installation, so you don't install them separately. Platform bundled libraries can only be used when a board of that platform is selected from the Arduino IDE's Tools > Board menu.

The authors of some boards platforms didn't bother to bundle a SoftwareSerial library, either because the boards of that platform already have abundant hardware serial ports, or just because they didn't get around to writing one. So when you have one of those boards selected, you will find you can't compile sketches that use the SoftwareSerial library. When possible, you should always use hardware serial instead of software serial.

Here is an example of a bundled SoftwareSerial library:

This is the one bundled with the Arduino AVR Boards platform of the Uno, Mega, Leonardo, etc.

But don't bother trying to download and install that library. If the platform of the board you are using doesn't have its own bundled SoftwareSerial library, there's a good reason for that. If it was as simple as just grabbing the library out of Arduino AVR Boards, I guarantee you that the platform author would have done that.

1 Like

Are you using a third-party board? One that is NOT an Arduino? Perhaps the folks who wrote the libraries for it left out the SoftwareSerial library.

Or maybe you are using an ANCIENT version of the Arduino IDE from before SoftwareSerial was added.

Or maybe your installation of the Arduino IDE has been damaged. You could try re-installing it.

johnwasser:
Or maybe you are using an ANCIENT version of the Arduino IDE from before SoftwareSerial was added.

I doubt it.

Release Notes:

ARDUINO 0007 - 2006.12.25

...

  • Added a SoftwareSerial library ...

The oldest version you can download from arduino.cc is 0013.

Update to 1.8.12, it is definitely there.
Your sketch should have
#include <SoftwareSerial.h>
to bring it in.
Then
SoftwareSerial mySerialA(4, 5); // RX, TX to invoke it on selected pins (328P, 1284P, 2560 chips anyway)

1 Like