I am doing a school project including a GPS sensor. I followed the steps in a video on Youtube called LESSON 22: Build an Arduino GPS Tracker - YouTube.
But I get these errors and I don't know how to fix it. I am new to coding(never had training). I think it is an error with punctuation, but I don't know where to fix it. Can someone please help me?
Here are the errors:
/Users/naomirray/Documents/Arduino/GPS_CODE_IT_1/GPS_CODE_IT_1.ino: In function 'void readGPS()':
GPS_CODE_IT_1:35: error: 'NMEA1' was not declared in this scope
NMEA1=GPS.lastNMEA();
^
exit status 1
'NMEA1' was not declared in this scope
#include <Adafruit_GPS.h> //Install the adafruit GPS library
#include <SoftwareSerial.h> // Load the Software Serial library
SoftwareSerial mySerial(3,2); // Initialize the Software Serial port
Adafruit_GPS GPS(&mySerial); //Create the GPS Object
String NMEAl; //Variable for first NMEA sentence
String NMEA2; //Variable for second NMEA sentence
char c; //to read characters coming from the GPS
void setup() {
Serial.begin(115200); //Turn on serial monitor
GPS.begin(9600); //Turn on GPS at 9600 baud
GPS.sendCommand("$PGCMD,33,0*6D"); //Turn off antenna update nuisance data
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_10HZ); //Set update rate to 10 hz
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA); //Request RMC and GGA Sentences only
delay(1000);
}
void loop() {
readGPS();
delay(750);
}
void readGPS() {
clearGPS();
while(!GPS.newNMEAreceived()) { //Loop until you have a good NMEA sentence
c=GPS.read();
}
GPS.parse(GPS.lastNMEA()); //Parse that last good NMEA sentence
NMEA1=GPS.lastNMEA();
while(!GPS.newNMEAreceived()) { //Loop until you have a good NMEA sentence
c=GPS.read();
}
GPS.parse(GPS.lastNMEA()); //Parse that last good NMEA sentence
NMEA2=GPS.lastNMEA();
Serial.println(NMEA1);
Serial.println(NMEA2);
Serial.println("");
}
void clearGPS() { // clear old and corrupy data from serial port
while(!GPS.newNMEAreceived()) { //Loop until you have a good NMEA sentence
c=GPS.read();
}
GPS.parse(GPS.lastNMEA()); //Parse that last good NMEA sentence
while(!GPS.newNMEAreceived()) { //Loop until you have a good NMEA sentence
c=GPS.read();
}
GPS.parse(GPS.lastNMEA()); //Parse that last good NMEA sentence
}