#include <SoftwareSerial.h>
class mySoftwareSerial {
public:
mySoftwareSerial(uint8_t rx, uint8_t tx, int var)
: comPort(SoftwareSerial(rx, tx)), var(var) {}
SoftwareSerial comPort;
int var;
};
mySoftwareSerial comPorts[] = {{2, 3, 0}, {4, 5, 1}};
void setup() {
Serial.begin(115200);
for (auto &port : comPorts) port.comPort.begin(9600);
for (auto &port : comPorts) Serial.println(port.comPort.isListening() ? "OFF" : "ON");
}
void loop() {}