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 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");
}
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.
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)