I am working on project for which i need to track the location of my vehicle here is the code below. I am using NEO 6M GPS module and SIM 800 A module.
Issues
1.) Connection to GPRS failed.
2.)sometimes i also get the error Cannot init.
3.) wasn’t online yet on android phone
#define BLYNK_PRINT Serial
#define TINY_GSM_MODEM_SIM800
#include<TinyGsmClient.h>
#include<BlynkSimpleSIM800.h>
#include <SoftwareSerial.h>
#include<TinyGPS++.h>
SoftwareSerial gsm(8,9);
TinyGPSPlus gps ;
char apn[]=" ";//
char auth[]=" ";//project authentication key
char user[]="";//blank
char pass[]="";//blank
WidgetMap myMap(V0);
TinyGsm modem(gsm);
unsigned int move_index=1;
void setup()
{
Serial.begin(9600);
gsm.begin(115200);
Blynk.begin(auth,modem,apn,user,pass);
}
void loop()
{
Blynk.run();
while(Serial.available())
{
gps.encode(Serial.read());
if (gps.location.isUpdated())
{
delay(1000);
gsm.println("AT+CMGF=1");
delay(1000);
gsm.println("AT+CMGS=\"**********\"\r");
delay(1000);
gsm.println("lattitude=");
gsm.println((gps.location.lat()),6);
gsm.println("longitude=");
gsm.println((gps.location.lng()),6);
gsm.println("Speed=");
gsm.println(gps.speed.mps(),1);
delay(1000);
gsm.println((char)26);
delay(1000);
Blynk.virtualWrite(V1,String((gps.location.lat()),6));
delay(10);
Blynk.virtualWrite(V2,String((gps.location.lng()),6));
delay(10);
myMap.location(move_index,gps.location.lat(),gps.location.lng(),"value");
delay(60000);
}
}
}