Could somebody make hundreths show in the display with this sketch? I added manually, but by now hundredths are showing exactly the same as seconds...
//Llibreries
#include <SoftwareSerial.h>//incluimos SoftwareSerial
#include <TinyGPS.h>//incluimos TinyGPS
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
//Definicions
#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
char str[70];
char *test="$GPRMC";
int temp,i;
int n = 1;
//Arrrancada de periferics
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 serial1(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);
serial1.begin(9600);//Iniciamos el puerto serie del gps
lcd.setCursor(0,0);
lcd.print("Buscando GPS");
}
void loop()
{
serial1Event();
if (temp)
{
int str_lenth=i;
int x=0,comma=0;
String UTC_hour="";
String UTC_minut="";
String UTC_second="";
String UTC_hundreth="";
String str1="";
while(x<str_lenth)
{
if(str[x]==',')
comma++;
if(comma==1)
{
x++;
UTC_hour+=str[x++];
UTC_hour+=str[x++];
UTC_minut+=str[x++];
UTC_minut+=str[x++];
UTC_second+=str[x++];
UTC_second+=str[x];
UTC_hundreth+=str[x++];
UTC_hundreth+=str[x];
comma=2;
}
x++;
}
int UTC_hourDec=UTC_hour.toInt();
int UTC_minutDec=UTC_minut.toInt();
int Second=UTC_second.toInt();
int Hundreth=UTC_hundreth.toInt();
int Hour=UTC_hourDec+2;
int Minut=UTC_minutDec+0;
if(Minut>59)
Minut-=60;
lcd.setCursor(0,0);
lcd.print("Salida:");
if (Hour<10){lcd.print(0);}
lcd.print(Hour);
lcd.print(":");
if (Minut<10){lcd.print(0);}
lcd.print(Minut);
lcd.print(":");
if (Second<10){lcd.print(0);}
lcd.print(Second);
lcd.print(";");
if (Hundreth<10){lcd.print(0);}
lcd.print(Hundreth);
temp=0;
i=0;
x=0;
str_lenth=0;
}
}
void serial1Event()
{
while(1)
{
while (serial1.available()) //checking serial data from GPS
{
char inChar = (char)serial1.read();
str[i]= inChar; //store data from GPS into str[]
i++;
if (i < 7)
{
if(str[i-1] != test[i-1]) //checking for $GPRMC sentence
{
i=0;
}
}
if(i>65)
{
temp=1;
break;
}
}
if(temp)
break;
}
}