#include <SoftwareSerial.h> // Software Serial library
SoftwareSerial GPS_Serial(5,6); // 5:RXD, 6:TXD
void GPS_Read(char *SoftSerialBuffer){
int i = 0; // Move first character position
char read_ch;
while (1) {
if (GPS_Serial.available()) { // Check empty buffer
read_ch = GPS_Serial.read(); // Read one character from buffer
SoftSerialBuffer[i] = read_ch; // Copy reading character to return-variable
if (read_ch == 10) break;
i++;
}
}
SoftSerialBuffer[i] = '\0'; // Set end-of-string as '\0'
}
void setup() { //***** set serial port speed (bps)
Serial.begin(115200); // USB
GPS_Serial.begin(9600); // Software Serial setting for GPS module
}
void loop() {
char GPS_Data_Raw[255]; // Buffer size is 254 characters.
Serial.println("Loop"); // Eye catcher
if (GPS_Serial.available()) { // Check empty buffer
GPS_Read(GPS_Data_Raw); // Call GPS_Read function routine
Serial.println(GPS_Data_Raw);
}
}