Esp8266 + GPS NEO-6M

Conectando o NEO-6M ao esp8266 NodeMcu de forma simples
Não esqueça de baixa a bibioteca “TinyGPS Plus

 

#include <TinyGPS++.h>
#include <SoftwareSerial.h>

//TXPin na porta D2 (porta 5)
static const int RXPin = 4, TXPin = 5;
static const uint32_t GPSBaud = 9600;

TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);

void setup(){
     Serial.begin(9600);
     ss.begin(GPSBaud);
}

void loop(){

 while (ss.available() > 0){
  gps.encode(ss.read());
  if (gps.location.isUpdated()){
     Serial.print("Latitude= "); 
     Serial.print(gps.location.lat(), 6);
     Serial.print(" Longitude= "); 
     Serial.println(gps.location.lng(), 6);
   }
 }
}

Deixe um comentário