Gps
Gps
Gps
h>
#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
TinyGPSPlus gps;
void setup() {
Serial.begin(9600);
gsm.begin(9600);
gps.begin(9600);
lcd.begin(16, 2);
pinMode(13, OUTPUT);
digitalWrite(13, LOW);
lcd.print("Vehicle Tracking");
lcd.setCursor(0, 1);
lcd.print(" System ");
delay(2000);
gsm_init();
lcd.clear();
lcd.print("GPS Initializing");
lcd.setCursor(0, 1);
lcd.print(" No GPS Range ");
delay(2000);
lcd.clear();
lcd.print("GPS Range Found");
lcd.setCursor(0, 1);
lcd.print("GPS is Ready");
delay(2000);
lcd.clear();
lcd.print("System Ready");
}
void loop() {
if (Serial.available() > 0) {
String input = Serial.readStringUntil('\n');
if (input == "Track Vehicle") {
trackingMode = true;
}
}
if (trackingMode) {
digitalWrite(13, HIGH);
tracking();
digitalWrite(13, LOW);
trackingMode = false;
}
void gsm_init() {
lcd.clear();
lcd.print("Finding Module..");
lcd.clear();
lcd.print("Echo OFF");
delay(1000);
lcd.clear();
lcd.print("Finding Network..");
lcd.clear();
lcd.print("Network Found..");
delay(1000);
lcd.clear();
}
void tracking() {
lcd.clear();
lcd.print("Tracking Vehicle");
gsm.println("AT+CMGF=1");
delay(400);
gsm.println("AT+CMGS=\"+252906034727\""); // Change with desired recipient's phone
number
delay(400);
gsm.print(message);
gsm.write(26); // End of message character
lcd.clear();
lcd.print("Message Sent");
delay(2000);
lcd.clear();
lcd.print("System Ready");
}