需要帮助将节点mcu连接到neo 6m gps模块

时间:2018-06-02 16:56:41

标签: nodemcu android-gps arduino-esp8266

有时打印gps编码可用的消息并打印纬度0和经度0,但它会连续打印软件序列可用的消息,但不会获取坐标。

#include <TinyGPS++.h>

#include <ESP8266WiFi.h>
#include <ArduinoJson.h>

#include <SoftwareSerial.h>
#define WIFI_SSID "tracker"
#define WIFI_PASSWORD "hello123"

static const int RXPin = 4, TXPin = 5;   // GPIO 4=D2(conneect Tx of GPS) and GPIO 5=D1(Connect Rx of GPS
static const uint32_t GPSBaud = 4800;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);



void setup() {
  Serial.begin(9600);


  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("connecting");
  while (WiFi.status() != WL_CONNECTED) 
  {
    Serial.print(".");
    delay(500);
  }
  Serial.println();
  Serial.print("connected: ");
  Serial.println(WiFi.localIP());

}


void loop() {



  if (ss.available() > 0) 
    {   
    Serial.println("SoftwareSerial" );

      if (gps.encode(ss.read())){

   Serial.println("Gps encode" );
        float latitude = (gps.location.lat());     //Storing the Lat. and Lon. 
    float longitude = (gps.location.lng()); 
       Serial.println(latitude);
     Serial.println(longitude);

     delay(1000);
      }strong text

  }

}

如何连接节点?

0 个答案:

没有答案