我有一个NodeMCU 1.0和一个ESP8266 12-EI创建了一些代码来检查GPS信号并报告回来,在NodeMCU上代码工作100%没有问题但是当我在ESP8266 12-e上加载代码时(带有NodeMCU闪现在它上面)我无法将GPS信号显示连接到相同的GPOI端口和所有内容。
大部分代码:
#include <TimGPS.h>
#include <SoftwareSerial.h >
#include "FS.h"
extern "C" {
#include "gpio.h"
#include "user_interface.h"
}
static const int RXPin = 12, TXPin = 255;
static const uint32_t GPSBaud = 9600;
TimGPS gps;
SoftwareSerial ss(RXPin, TXPin);
void printGPSData()
{
Serial.print("Latitude : ");
Serial.println(gps.location.lat(), 6);
Serial.print("Longitude : ");
Serial.println(gps.location.lng(), 6);
Serial.print("Speed : ");
Serial.println(gps.speed.mph(), 6);
Serial.print("Satellites: ");
Serial.println(gps.satellites.value());
Serial.print("Time UTC : ");
Serial.print(gps.time.hour());
Serial.print(":");
Serial.print(gps.time.minute());
Serial.print(":");
Serial.println(gps.time.second());
}
static void smartDelay(unsigned long ms)
{
unsigned long start = millis();
do
{
while (ss.available())
gps.encode(ss.read());
} while (millis() - start < ms);
}
void setup() {
Serial.begin(115200);
Serial.println("Startup");
ss.begin(GPSBaud);
}
void loop() {
if (millis() > 5000 && gps.charsProcessed() < 10) {
Serial.println(F("No GPS data received: check wiring"));
}
else
{
printGPSData(url);
}
}