Hi all. I am using a dexter industries arduino shield on my duemilanove. For the time being i am just trying to acquire velocity. The problem i am having, is the arduino will display my current velocity for a short amount of time (1 second or so) then display zero knots/MPH for a longer period of time (5-10 seconds or so) and it just continues this loop. I believe the problem is i am not refreshing the GPS data properly but with the example code that was included with the library, i am having trouble figuring out how to do so.
here is the shield i have:
http://dexterindustries.com/Arduino-GPS_Shield.html
here is the library and examples:
Here is the code i am running:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Set the LCD I2C address
#include "string.h"
#include "ctype.h"
#include "SoftwareSerial.h"
#include "dGPS.h"
// Software serial TX & RX Pins for the GPS module
// Initiate the software serial connection
float desLat=0; //Destination Latitude filled by user in Serial Monitor Box
float desLon=0; //Destination Longitude filled by user in Serial Monitor Box
dGPS dgps = dGPS(); // Construct dGPS class
float MPH = 0;
float KNOTS = 0;
void setup()
{
Serial.end(); // Close any previously established connections
Serial.begin(9600); // Serial output back to computer. On.
dgps.init(); // Run initialization routine for dGPS.
lcd.begin(16,2);
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Loading...");
delay(1000);
}
void loop()
{
//[i]sounds simple enough but its not doing what this comment says[/i]
dgps.update(desLat, desLon); // Calling this updates the GPS data. The data in dGPS variables stays the same unless
// this function is called. When this function is called, the data is updated.
Serial.print("Knots: ");
Serial.print(dgps.Vel(), 6); // Velocity, in knots.
KNOTS = dgps.Vel();
MPH = (KNOTS)*1.15;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("MPH: ");
lcd.print(MPH);
lcd.setCursor(0,1);
lcd.print("Knots: ");
lcd.print(dgps.Vel());
delay(2000); // i included this per dexter industries request, they seemed to think i was polling for data
} // faster than the gps module could supply. I didnt think that was the problem, but tried
// anyway. All it did was hold the current reading a little longer before reading zero again.
Thanks in advanced