/*
14CORE Samples test code for GPS navigation with NEO
This is a test code for TINYGPS device
Please follow the diagram below for the wiring
*/
#include <SoftwareSerial.h>
#include <TinyGPS.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,20,4); // Address used for the 16x2 LCD
TinyGPS gps;
SoftwareSerial ss(4, 3); // Define as software serial mounted as tx and rx
void setup()
{
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
lcd.print("14CORE| GPS TEST");
lcd.setCursor(0,1);
lcd.print("--------------------");
Serial.begin(115200); // Boud rate 115200 PC to the Device Communication
ss.begin(4800); // Serial communication at boud rate 4800 GPS to MCU
lcd.setCursor(0,1);
lcd.print("GPS Initializing.... ")
Serial.print("Initializing ..."); Serial.println(TinyGPS::library_version());
lcd.setCursor(0,1);
lcd.print(TinyGPS::library_version());
Serial.println();
}
void loop()
{
bool newData = false;
unsigned long chars;
unsigned short sentences, failed;
// One second we parse GPS data and report some key values
for (unsigned long start = millis(); millis() - start < 1000;)
{
while (ss.available())
{
char c = ss.read();
// Serial.write(c);
if (gps.encode(c))
newData = true;
}
}
if (newData)
{
float flat, flon;
unsigned long age;
gps.f_get_position(&flat, &flon, &age);
lcd.setCursor(0,0);
lcd.print("LAT=");
lcd.setCursor(0,1);
lcd.print(flat == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flat, 6);
delay(10000);
lcd.setCursor(0,0);
lcd.print(" LON=");
lcd.setCursor(0,1);
lcd.print(flon == TinyGPS::GPS_INVALID_F_ANGLE ? 0.0 : flon, 6);
delay(10000);
lcd.setCursor(0,1);
lcd.print(" SAT=");
lcd.setCursor(0,0);
lcd.print(gps.satellites() == TinyGPS::GPS_INVALID_SATELLITES ? 0 : gps.satellites());
delay(10000);
lcd.setCursor(0,0);
lcd.print(" PREC=");
lcd.setCursor(0,1);
lcd.print(gps.hdop() == TinyGPS::GPS_INVALID_HDOP ? 0 : gps.hdop());
delay(10000);
}
gps.stats(&chars, &sentences, &failed);
lcd.setCursor(0,0);
lcd.print(" CHARS=");
lcd.setCursor(1,0);
lcd.print(chars);
delay(10000);
lcd.setCursor(0,0);
lcd.print(" SENTENCES=");
lcd.setCursor(0,1);
lcd.print(sentences);
delay(1000);
lcd.setCursor(0,0);
lcd.print(" CSUM ERR=");
lcd.setCursor(0,1);
lcd.println(failed);
if (chars == 0)
lcd.clear();
lcd.println("ERROR CHECK GPS");
}
Hey,
i get the error: setcursor was not declared in this scope.
Can you help me please?
I have made this but it doesnt display anything. Can you help me?
Before you;ve going to use it on the LCD try to use first the serial log / Write it on the serial log first. :D
I think the error is line 70: setCursor(0,1);
Should be: lcd.setCursor(0,1);
Updated… lcd.setCursor(0,1); most probably typo error. :D