Hello,
I am getting error as below:
NMEA2=GPS.lastNMEA();
exit status 1
'string' does not name a type
Below is my full code:
#include <Adafruit_GPS.h>
#include <String.h>
#include <SoftwareSerial.h>
SoftwareSerial myserial(3,2); //This is a serial port where TX[3 port] and RX[2 port] are connected
Adafruit_GPS GPS(&myserial); //Create the GPS object
string NMEA1; // Hold the GPS data
string NMEA2; // Hold the GPS data
char c;
void setup() {
Serial.begin(115200); //Turn on serial Monitor
GPS.begin(9600); // Turn on GPS at 9600 Baud rate Speed
GPS.sendCommand("$PGCMD,33,0*6D"); //Turns off the antenna for garbage value
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA); // Only RMC and GGA will taken into consideration
delay(1000);
}
void loop() {
readGPS();
}
void readGPS(){
while(!GPS.newNMEAreceived()){
c=GPS.read();
}
GPS.parse(GPS.lastNMEA());
NMEA1=GPS.lastNMEA();
while(!GPS.newNMEAreceived()){
c=GPS.read();
}
GPS.parse(GPS.lastNMEA());
NMEA2=GPS.lastNMEA();
Serial.println(NMEA1);
Serial.println(NMEA2);
}
Can you please help..
Thanks-
Pokhraj