I want to extract the latitude and longitude values of my location but my gps led is not blinking. Also result appearing on the serial monitor is wrong.
This is my Arduino code:
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
SoftwareSerial gpsSerial(3, 4);
TinyGPSPlus gps;
float latitude,longitude;
void setup() {
// put your setup code here, to run once:
gpsSerial.begin(9600);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
while(gpsSerial.available())
{
int data=gpsSerial.read();
if(gps.encode(data))
{
latitude = (gps.location.lat());
longitude = (gps.location.lng());
Serial.print("Latitude");
Serial.println(latitude);
Serial.print("Longitude ");
Serial.println(longitude);
}
}
}
Please tell me what is wrong in the code?
my gps led is not blinking, then you also need to explain what that means – jsotola Mar 09 '19 at 23:47