Note: if you look at the loop there are two programs in one. I have one REM-ed out. Just unRem out the first, and Rem the second to see first Program's results.
//continued from previous post
#include <SoftwareSerial.h>
#define RxPIN 3
#define TxPIN 4
TinyGPS gps;
SoftwareSerial GpsSerial(RxPIN, TxPIN);
void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
Serial.println("Start");
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println("Goodnight moon!");
// set the data rate for the SoftwareSerial port
// 9600 NMEA is the default baud rate for MTK - some use 4800
// LS20031 uses 57600
GpsSerial.begin(57600); //Adafruit- 9600, Sparkfun- 57600
GpsSerial.print(PMTK_SET_NMEA_OUTPUT_ALLDATA2); // $GPxxx Messages
GpsSerial.print(PMTK_SET_NMEA_UPDATE_1HZ); // messages 1 times a second
GpsSerial.print(PMTK_Q_RELEASE);
}
void loop(){ // run over and over
/*while (GpsSerial.available()){
unsigned char cc = GpsSerial.read();
if (gps.encode(cc)) {
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
Serial.print("Lat: ");
Serial.print(flat);
Serial.print(", Long: ");
Serial.print(flon);
Serial.print(", age: ");
Serial.println(age);
}
}*/
if (GpsSerial.available())
Serial.write(GpsSerial.read());
if (Serial.available())
GpsSerial.write(Serial.read());
}
--------------------------------------------------------- end of first program --------------------------------------------------------------------------------
If you got that working you might want to try Mikal Hart TinyGPS's modified example for the LS20031 (only).>>
** You STILL have to use the Logic converter between your Arduino and the LS20031- If you don't you could kill your LS20031.**
** Also- you can use whatever Logic converter you want- just know I have killed a few of the cheap mosfet converter sitting on my desk.**
** The DssCircuits.com is for sale | HugeDomains, one has survived my desk for 6 months and I haven't killed it.**
NOTE: this can be used with Adafruit's LCD I2C backpack. It will work with out it. I have everything to do with the I2C backpack REM out. If you do you will need to get the LiquidTWI library from Adafruit if you want to try out the LCD- also I am using a 4x16 LCD with this.
(sorry I was forced to have to break up the following code).