#include "TinyGPS++.h"
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial
char auth[] = "M-Ee2Vubx7Pf5DbN8_5SFvSAjkSCNB_0";
char ssid[] = "MR DOM";
char pass[] = "audomidea2019";
BlynkTimer timer;
TinyGPSPlus gps;
void setup()
{
Serial.begin(9600);
Serial.println("GPS Start");
Blynk.begin(auth, ssid, pass);
timer.setInterval(1000L, sendGPS);
}
String lat_ ;
String lon_ ;
int speed_ = 0 ;
int Index1 = 0;
void sendGPS()
{
Blynk.virtualWrite(V1, Index1, lat_, lon_, "value");
Blynk.virtualWrite(V2, speed_);
}
void loop()
{
Blynk.run();
timer.run();
while(Serial.available())
{
gps.encode(Serial.read());
}
if(gps.location.isUpdated())
{
lat_ = String(gps.location.lat(),6);
lon_ = String(gps.location.lng(),6);
speed_ = gps.speed.mph() ;
Serial.println("Latitude:");
Serial.println(lat_);
Serial.println("Longitude:");
Serial.println(gps.location.lng(), 6);
Serial.println("Speed MPH:");
Serial.println(gps.speed.mph());
Serial.println("");
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น