#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
#include <TinyGPS++.h>
SMSGSM sms;
static const int RXPin = 7, TXPin = 8;
static const uint32_t GPSBaud = 9600;
TinyGPSPlus gps;
SoftwareSerial ss(RXPin, TXPin);
char message[160];
char datetime[24];
char latitude[12];
char longitude[12];
char number[]="123123123";
char text[160];
char pos;
char *p;
char *c;
void setup()
{
Serial.begin(9600);
ss.begin(GPSBaud);
Serial.println("START");
gsm.begin(2400);
sms.SendSMS("123123123", "system ok"); // on setup SMS is sent to my number letting me know device is ON
}
void loop()
{
while (ss.available() > 0)
if (gps.encode(ss.read()))
if (gps.location.isValid())
{
strcat(text, "comgooglemaps://?q=");
dtostrf(gps.location.lat(), 1, 6, latitude);
strcat(text,latitude);
strcat(text,",");
dtostrf(gps.location.lng(), 1, 6, longitude);
strcat(text,longitude);
}
pos=sms.IsSMSPresent(SMS_UNREAD);
Serial.println((int)pos);
if((int)pos>0&&(int)pos<=20){
Serial.print("Incomming message, POS=");
Serial.println((int)pos);
message[0]='\0';
sms.GetSMS((int)pos,number,message,180);
p=strstr(message,"Rotor");
if(p)
{
Serial.println("Success");
Serial.println(text);
sms.SendSMS(number, text); // When anybody send SMS with password=="Rotor" ==> device sends back coordinates in mobile link to google maps
}
}
sms.DeleteSMS((int)pos);
delay(5000);
}
The problem is that I get empty message from the module when I send SMS with message "Rotor".
Serial.println(text) is also empty.
I am not using GSM Shield. I am using a red SIM800L module and NEO-6M GPS. Both modules are working apart but there is something wrong with converting variable latitude and longitude... ;/
Hello, I'm working on a similar project but my problem is the following I'm using the gps 6m neo ublox and grps-gsm sim900 and I want you to send me the coordinates ami phone this is my programming and it does not work for me could help me with this great doubt would help me a lot!
In the method void commands (); I make the call of the variables and continue doing the function of gps.getDataGPRMC but I have that doubt for what reason I only receive blank messages! And not the coordinates
I'm trying to use some like this, but i'm using an Arduino Uno, with SIM800L at Serial (7,8) and NEO 6M at Serial (10,11). I'm trying to send GPS coordinates by SMS. The code is below:
I tried everything I've read here, ".listen()" commands, "delay()", but, it seems that SMS Serial is never available. I edited the SIM800L library to set pins 6 and 7 for RX and TX. It worked when it's alone, but when I attach the GPS shield, it stops.