Softwareserial.h Library Instant

The classic Arduino Uno, Nano, and Mega 2560 (for its first few ports) have dedicated hardware UARTs (Universal Asynchronous Receiver-Transmitters). However, hardware UARTs are limited in number. Once you connect a GPS module, a Bluetooth module, and a debug console simultaneously, you run out of ports.

port1.listen(); // Switch back

void sendString(SoftwareSerial &ss, char *msg) ss.listen(); // Ensure we're not receiving delay(1); // Allow any pending RX to finish ss.print(msg);

You can create multiple instances, but only one can receive at a time . The active receiver is set by the last call to listen() .