SIR...PLEASE HELP ME IN SOLVING MY PROBLEM
#include <TinyGPS.h>
int GPSBaud = 9600;
float lat,lon ;
String latitude,longitude ;
// Create a TinyGPS++ object
TinyGPS gps;
void setup()
{
// Start the Arduino hardware serial port at 9600 baud
Serial.begin(9600);
// Start the software serial port at the GPS's default baud
}
void loop()
{
// This sketch displays information every time a new sentence is correctly encoded.
while (Serial.available() > 0)
if (gps.encode(Serial.read()))
{
gps.f_get_position(&lat,&lon); // get latitude and longitude
}
displayInfo();
delay(1000);
SendMessage();
// If 5000 milliseconds pass and there are no characters coming in
// over the software serial port, show a "No GPS detected" error
}
void displayInfo()
{
Serial.println(latitude);// Messsage content
Serial.println(longitude);
delay(100);
Serial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}
void SendMessage()
{
Serial.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode
delay(1000);
Serial.println("AT+CMGS="XXXXXXXXXX"\r"); //Mobile phone number to send message
delay(1000);
Serial.println("Help::EMERGENCY");
Serial.println(latitude);// Messsage content
Serial.println(longitude);
delay(100);
Serial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}
THE GPS IS GIVING 0.00 AS OUTPUT IN SERIAL MONITOR
sai.ino (1.38 KB)