LCD Display With Gps Tracker

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

#include <SoftwareSerial.

h>
#include <TinyGPS++.h>
#include <LiquidCrystal.h>

// LCD pins connections


LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

// GPS module and GSM module connections


SoftwareSerial ss(10, 13); // RX, TX
TinyGPSPlus gps;

// Variables to store the current position


float latitude, longitude;

void setup() {
Serial.begin(9600);
ss.begin(9600);
lcd.begin(16, 2);
}

void loop() {
if (ss.available() > 0) {
gps.encode(ss.read());
if (gps.location.isUpdated()) {
latitude = gps.location.lat();
longitude = gps.location.lng();

// Display the current position on the LCD


lcd.setCursor(0, 0);
lcd.print("Lat: ");
lcd.print(latitude, 6);
lcd.print(" Lng: ");
lcd.println(longitude, 6);
}
}
}

You might also like