Hallo,
bei mir hat dieser Code funktioniert.
/*
This Sketch will run with the SkyNav SKM53 GPS if.....
RXD Arduino Pin 3
TXD Arduino Pin 2
RST Leave Open ? (Connect to a N/O momentary switch pulled low to reset?)
NC Leave Open
GND Ground
VCC +5
This is not a great program but it will tell you where you are in the world.
Make sure you download and save to your Arduino/Libraries folder TinyGPS.h
and SoftwareSerial.h files.
*/
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <TinyGPS.h>
#include <SoftwareSerial.h>
LiquidCrystal_I2C lcd(0x20,16,2);
unsigned long fix_age;
SoftwareSerial 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(9600);
lcd.init(); // initialize the lcd
// Print a message to the LCD.
lcd.backlight();
}
void loop(){
long lat, lon;
unsigned long fix_age, time, date, speed, course;
unsigned long chars;
unsigned short sentences, failed_checksum;
// retrieves +/- lat/long in 100000ths of a degree
gps.get_position(&lat, &lon, &fix_age);
getGPS();
lcd.setCursor(0,0);
lcd.print("Lt: ");
lcd.print(LAT/1000000,6);
lcd.setCursor(0,1);
lcd.print("Ln: ");
lcd.print(LON/1000000,6);
//Serial.print("Latitude : ");
//Serial.print(LAT/100000,7);
//Serial.print(" :: Longitude : ");
//Serial.println(LON/100000,7);
delay(1000);
}
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
}
}
Ich habe ihn mir zwar auf ein I2C LCD umgeändert, aber sonst quasi der Standard. 9600 Baud und dann bei der SoftwareSerial die 2 und die 3
Wenn das GPS Modul anfängt mit blinken, dann hat es schon mal Empfang. Dann kommt nur noch Baudrate und RX, TX vertauscht in Betracht. Einfach beide Kabel mal tauschen und am Arduino Reset drücken. Der Empfang war zwar nicht berauschend, da die Koordinaten ziemlich rumsparangen. Ich hatte mir im Netz mal eine Seite gesucht, wo man Anhand zweier Geokoordinaten die Entfernung beider Punkte ausrechnen konnte. Das waren bei mir ca. 80 Meter zwischen den Messungen. Drinnen hat er wohl nicht all zu viele Satelliten gesehen. Aber wenns blinkt, hast du schon mal gewonnen.
Werde demnächst mal ins Freie gehen und gucken, wie groß die Sprünge dort ausfallen. Warte nur noch auf die Platinen LiPo auf 5V Out vom Chinamann. Dann kann ich von den verblichenen Handys und Digicams die Lithiumakkus recyceln
Gruß Gerald