CODE
#define BLYNK_PRINT Serial
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
char auth[] = "YOUR BLYNK AUTH ID";
char ssid[] = "WI-FI NAME";
char pass[] = "WI-FI PASSWORD";
int GPSBaud = 9600;
float lat;
float lon;
TinyGPSPlus gps;
int RXPin = D2;
int TXPin = D3;
float startTime;
SoftwareSerial gpsSerial(RXPin, TXPin);
WidgetMap myMap(V1);
WidgetLCD lcd(V4);
BlynkTimer timer;
void yn()
{
int index = 0;
float lat = (gps.location.lat());
float lon = (gps.location.lng());
myMap.location(index, lat, lon, "value");
lcd.print(1, 0, lat); // use: (position X: 0-15, position Y: 0-1, "Message you want to print")
lcd.print(1, 1, lon);
}
void setup()
{
gpsSerial.begin(GPSBaud);
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
void loop()
{
if (millis() > startTime + 60000) {
startTime = millis();
}
while (gpsSerial.available() > 0)
if (gps.encode(gpsSerial.read()))
if (millis() > 5000 && gps.charsProcessed() < 10)
{
Serial.println("No GPS detected");
while(true);
}
if (gps.location.isValid())
{
Serial.print(" lat: ");
Serial.print(gps.location.lat(),7);
Serial.println();
// use: (position X: 0-15, position Y: 0-1, "Message you want to print")
Serial.print(" lng: ");
Serial.println(gps.location.lng(),7);
yn();
}
else
{
Serial.print(F("INVALID"));
Serial.println();
}
Blynk.run();
timer.run();
}