Softwareserial.h Library — ((link))
void checkForData(SoftwareSerial &ss) ss.listen(); if (ss.available()) // Process
For ESP8266/ESP32, note that they have a different SoftwareSerial implementation (often renamed or not available due to better hardware serial options). softwareserial.h library
To use the library, you must first include it at the top of your sketch and then define your pins: void checkForData(SoftwareSerial &ss) ss
void loop() if (gps.available()) char c = gps.read(); Serial.print(c); // Echo GPS data to Serial Monitor void checkForData(SoftwareSerial &ss) ss.listen()