GPS code in Nodemcu ESP8266
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
const char* host = "GPS_NodeMCU";
const char* ssid = "GPS_BOT";
String latitude, longitude;
String lat_str , lng_str;
ESP8266WebServer server(80);
static const uint32_t GPSBaud = 9600;
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(4, 5);
void setup() {
Serial.begin(115200);
ss.begin(GPSBaud);
// Connecting WiFi
WiFi.mode(WIFI_AP);
WiFi.softAP(ssid);
// Starting WEB-server
server.on ( "/", HTTP_handleRoot );
server.onNotFound ( HTTP_handleRoot );
server.begin();
}
void loop() {
server.handleClient();
delay(50);
w
hile (ss.available() > 0){
gps.encode(ss.read());
if (gps.location.isUpdated()){
lat_str = String(gps.location.lat() , 6); // latitude location is stored in a string
lng_str = String(gps.location.lng(), 6); //longitude location is stored in a string
latitude = "Latitud = " + lat_str;
longitude = "Longitud = " + lng_str;
}
}
}
void HTTP_handleRoot(void) {
server.send(200, "text/plain", latitude + "," + longitude);
if( server.hasArg("State") ){
Serial.println(server.arg("State"));
}
server.send(200,"text/html","" );
}
This is the output in web
This is the example layout for MIT App
How to get the longitude and latitude value in my web and display in the MIT App. Sorry guys I’m just a student and still learning how to code sorry