Hi all, iv modified a BT359 bluetooth gps. iv managed to cut it in half, work out the power and tx pins. and attached to a sd shield. Its all working fine, gives the correct lat and long, time, altitude and everything else that is should but the date only appears as 2000?
heres my code
#include <SoftwareSerial.h>
#include <TinyGPS.h>
#define RXPIN 6
#define TXPIN 1
//Set this value equal to the baud rate of your GPS
#define GPSBAUD 38400
// Create an instance of the TinyGPS object
TinyGPS gps;
// Initialize the SoftwareSerial library to the pins you defined above
SoftwareSerial mySerial = SoftwareSerial (RXPIN, TXPIN);
// This is where you declare prototypes for the functions that will be
// using the TinyGPS library.
void getgps(TinyGPS &gps);
// In the setup function, you need to initialize two serial ports; the
// standard hardware serial port (Serial()) to communicate with your
// terminal program an another serial port (NewSoftSerial()) for your
// GPS.
void setup()
{
// This is the serial rate for your terminal program. It must be this
// fast because we need to print everything before a new sentence
// comes in. If you slow it down, the messages might not be valid and
// you will likely get checksum errors.
Serial.begin(115200);
//Sets baud rate of your GPS
mySerial.begin(GPSBAUD);
}
// This is the main loop of the code. All it does is check for data on
// the RX pin of the ardiuno, makes sure the data is valid NMEA sentences,
// then jumps to the getgps() function.
void loop()
{
while(mySerial.available()) // While there is data on the RX pin...
{
int c = mySerial.read(); // load the data into a variable...
if(gps.encode(c)) // if there is a new valid sentence...
{
getgps(gps); // then grab the data.
}
}
}
void getgps(TinyGPS &gps)
{
float latitude, longitude;
gps.f_get_position(&latitude, &longitude);
Serial.print("Lat/Long: ");
Serial.print(latitude,5);
Serial.print(", ");
Serial.println(longitude,5);
//date and time
int year;
byte month, day, hour, minute, second, hundredths;
gps.crack_datetime(&year, &month, &day, &hour, &minute, &second, &hundredths);
// Print data and time
Serial.print("Date: "); Serial.print(month, DEC); Serial.print("/");
Serial.print(day, DEC); Serial.print("/"); Serial.print(year);
Serial.print(" Time: "); Serial.print(hour, DEC); Serial.print(":");
Serial.print(minute, DEC); Serial.print(":"); Serial.print(second, DEC);
Serial.print("."); Serial.println(hundredths, DEC);
Serial.print("No. of Sats: ");Serial.println(gps.satellites());
Serial.print("Altitude (meters): "); Serial.println(gps.f_altitude());
Serial.print("Course (degrees): "); Serial.println(gps.f_course());
Serial.print("Speed(mph): "); Serial.println(gps.f_speed_mph());
Serial.println();
Serial.print("http://maps.google.com/maps?q="); Serial.print(latitude,8); Serial.print(",+"); Serial.println(longitude,8);
Serial.println();
}
this is whats printed in the serial window
Lat/Long: 51.36834, -2.13551
Date: 0/0/2000 Time: 20:54:36.0
No. of Sats: 5
Altitude (meters): 46.10
Course (degrees): 1000.00
Speed(mph): -1.00
http://maps.google.com/maps?q=51.36833953,+-2.13550996
anyone know what im doing wrong???
thanks in advance
Rob