Well, I figured I’d like to take a look at trying to get some GPS data from my recent purchase of the GPS-11466. I also purchased: GPS-09123 and BOB-10402.
I’m at a loss on where to start to try to develop some simple code for this though. This being my first thing I’ve ever coded for my mega (minus the “blink” program modification). I took a loot at this library: http://arduiniana.org/libraries/tinygps/ and thought it looked pretty simple to use. So I grabbed my Mega 2560, bread board, and hardware and hooked it up to 3.3V, gnd, rx → pin3 and tx → pin4. I mean the library looks very I simple to use. I opened the simple_test sketch and uploaded it to the controller. I opened up the serial port monitor and I’m getting the following:
CHARS=0 SENTENCES=0 CSUM ERR=0 repeatedly. I put in some Serial.println (write) statements along the way, and it looks like the SoftwareSerial is not available. The code segment that I added ```
Serial.write(“Software Serial is available”);
I guess I'm at a loss and as much as I hesitate to ask for a guaranteed working source code, does anyone have a link to some source code that I can upload to my Mega 2560 and verify that the GPS module is in fact working? Or if not, can someone point me in the right direction?
Thanks in advance. Below is the sketch I'm using.
- Josh
In the code:
#include <SoftwareSerial.h>
#include <TinyGPS.h>
/* This sample code demonstrates the normal use of a TinyGPS object.
It requires the use of SoftwareSerial, and assumes that you have a
4800-baud serial GPS device hooked up on pins 3(rx) and 4(tx).
*/
TinyGPS gps;
SoftwareSerial ss(3, 4);
void setup()
{
Serial.begin(115200);
ss.begin(4800);
Serial.print("Simple TinyGPS library v. "); Serial.println(TinyGPS::library_version());
Serial.println(“by Mikal Hart”);
Serial.println();
}
void loop()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// For one second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (ss.available())
{
Serial.write(“Software Serial is available”);
char c = ss.read();
Serial.write(c); // uncomment this line if you want to see the GPS data flowing
if (gps.encode(c)) // Did a new valid sentence come in?
newData = true;
}
}
if (newData)
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print(“LAT=”);
Serial.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
Serial.print(" LON=“);
Serial.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
Serial.print(” SAT=“);
Serial.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
Serial.print(” PREC=");
Serial.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
}
gps.stats(&chars, &sentences, &failed);
Serial.print(" CHARS=“);
Serial.print(chars);
Serial.print(” SENTENCES=“);
Serial.print(sentences);
Serial.print(” CSUM ERR=");
Serial.println(failed);
}