Hello again, yesterday I finally got a code which also do what I want, it's not so tricky (but still hard to typ it for me >:( ) and the result is pretty good. The LCD shows the time with Hours, Minutes, Seconds, and decimals. The clock gets updated every seccond while the GPS is fixed, but I would like to she the hundreths runing there in the LCD, not only the secconds, could somebody take a look at it? I think i'm near to what I need ![]()
I use TinyGPS library for the module and New Liquid Crystal one for the LCD
#include <SoftwareSerial.h>//incluimos SoftwareSerial
#include <TinyGPS.h>//incluimos TinyGPS
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR  0x3F // <<----- Add your address here. Find it from I2C Scanner
#define BACKLIGHT_PINÂ Â 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
int n = 1;
LiquidCrystal_I2CÂ lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
TinyGPS gps;//Declaramos el objeto gps
SoftwareSerial serialgps(4,3);//Declaramos el pin 4 Tx y 3 Rx
//Declaramos la variables para la obtenciĂłn de datos
int year;
byte month, day, hour, minute, second, hundredths;
unsigned long chars;
unsigned short sentences, failed_checksum;
void setup()
{
lcd.begin(20,4);//Iniciamos el puerto serie
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home
serialgps.begin(9600);//Iniciamos el puerto serie del gps
//Imprimimos:
lcd.setCursor(0,0);
lcd.print("Buscando GPS");
}
void loop()
{
while(serialgps.available())
{
int c = serialgps.read();
if(gps.encode(c))
{
gps.crack_datetime(&year,&month,&day,&hour,&minute,&second,&hundredths);
lcd.setCursor(0,0);
lcd.print(" Hora: "); lcd.print(hour, DEC); lcd.print(":");
lcd.print(minute, DEC); lcd.print(":"); lcd.print(second, DEC);
lcd.print("."); lcd.print(hundredths, DEC);
gps.stats(&chars, &sentences, &failed_checksum);
}
}
}