hello,am using gps module skylab skm53 and gsm-gprs module, iwanted to send to the coords of the
gps to a specific number i tried my code but it's not working anyone can help me with that or can give me a valid code ? and ty in advance
my code:
#include <TinyGPS.h>
#include "SoftwareSerial.h"
#define HEMISPHERE_PIN 13
#define GPS_RX_PIN 4
#define GPS_TX_PIN 5
#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
TinyGPS gps; // create a TinyGPS object
SoftwareSerial ss(GPS_RX_PIN, GPS_TX_PIN); // create soft serial object
SMSGSM sms;
int numdata;
boolean started=false;
char smsbuffer[160];
char n[20];
char sms_position;
char phone_number[20]; // array for the phone number string
char sms_text[100];
int i;
void setup()
{
Serial.begin(9600); // for debugging
ss.begin(9600); // Use Soft Serial object to talk to GPS
pinMode(HEMISPHERE_PIN, OUTPUT);
digitalWrite(HEMISPHERE_PIN, LOW); // turn off LED to start
//Serial connection.
Serial.begin(4800);
Serial.println("GSM Shield testing.");
}
void loop()
{
while (ss.available())
{
int c = ss.read();
Serial.write(c); // display NMEA data for debug
// Send each byte to encode()
// Check for new position if encode() returns "True"
if (gps.encode(c))
{
long lat, lon;
unsigned long fix_age;
gps.get_position(&lat, &lon, &fix_age);
if (fix_age == TinyGPS::GPS_INVALID_AGE )
Serial.println("No fix ever detected!");
else if (fix_age > 2000)
Serial.println("Data is getting STALE!");
else
Serial.println("Latitude and longitude valid!");
Serial.print("Lat: ");
Serial.print(lat);
Serial.print(" Lon: ");
Serial.println(lon);
if (gsm.begin(4800))
{
Serial.println("\nstatus=READY");
started=true;
}
else
Serial.println("\nstatus=IDLE");
if(started)
{
//Enable this two lines if you want to send an SMS.
if(sms.SendSMS("01095159539", lat, lon));
Serial.println("\nSMS sent OK");
}
if (lat < 0) // Southern Hemisphere?
digitalWrite(HEMISPHERE_PIN, HIGH);
else
digitalWrite(HEMISPHERE_PIN, LOW);
}
}
}