Arduino Unoをskm53 GPSモジュールに接続しようとしていますが、Arduinoソフトウェアでスケッチをアップロードする前に確認し、次のエラーが見つかりました。Arduino UnoとSKYNAV skm53 GPSモジュールとの接続エラー
Error: #error NewSoftSerial has been moved into the Arduino core as of version 1.0. Use SoftwareSerial instead.
私はArduinoのツールのライブラリディレクトリ内のライブラリのTinyGPSとNewSoftSerialが含まれていた、私が検索し、ほぼすべてのコードは私と同じであることを見出しました。
#include <TinyGPS.h>
#include <NewSoftSerial.h>
unsigned long fix_age;
NewSoftSerial GPS(2,3);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;
void setup(){
GPS.begin(9600);
//Serial.begin(115200);
}
void loop(){
long lat, lon;
unsigned long fix_age, time, date, speed, course;
unsigned long chars;
unsigned short sentences, failed_checksum;
// Retrieves +/- latitude/longitude in 100000ths of a degree.
gps.get_position(&lat, &lon, &fix_age);
getGPS();
Serial.print("Latitude : ");
Serial.print(LAT/100000,7);
Serial.print(" :: Longitude : ");
Serial.println(LON/100000,7);
}
void getGPS(){
bool newdata = false;
unsigned long start = millis();
// Every 1 seconds we print an update.
while (millis() - start < 1000)
{
if (feedgps()){
newdata = true;
}
}
if (newdata)
{
gpsdump(gps);
}
}
bool feedgps(){
while (GPS.available())
{
if (gps.encode(GPS.read()))
return true;
}
return 0;
}
void gpsdump(TinyGPS &gps)
{
//byte month, day, hour, minute, second, hundredths;
gps.get_position(&lat, &lon);
LAT = lat;
LON = lon;
{
feedgps(); // If we don't feed the GPS during this long
//routine, we may drop characters and get
//checksum errors.
}
}