sim908 read UTC from serial

Status
Not open for further replies.

rbbahia

Newbie level 1
Joined
Mar 25, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
8
Hello,

I'm working on a tracker, using Sim908, using the command: AT + CGPSINF = 0
I can see on the screen 0,0.000000,0.000000,0.000000,20150105235953.000,0,0,0.000000,0.000000
and after synchronize see this:
0, -12.958474, -1239.5747474,20150105235953.000,0,0,0.000000,0.000000

I am sending sms by the latitude, longitude and datetime, while the GPS does not synchronize I get the sms lat, long and full UTC 0.000000,0.000000,20150105235953

but after the gps synchronize the hour minute and second no longer appear on sms thereby: -12.958474, -1239.5747474,20150105

where is the problem?

CODE SMS SEND:
Code:
****mySerial.println ("AT + CMGF = 1"); // Change the receiver phone number
****delay (2000);
**mySerial.println ("AT + CMGS = \" 7588746080 \ ""); // Change the receiver phone number
**delay (2000);
**mySerial.print (gpslat, 6);
**mySerial.print (',');
**mySerial.print (gpslong, 6);
**mySerial.print (',');
**mySerial.print (datetime);
**mySerial.print (',');
**mySerial.println ("");

SEPARATE DATA STANDING IN STRING IN COMMA
Code:
**mySerial.println ("AT + CGPSINF = 0");
**read_string ();
**strtok (INDATA, "");
**strcpy (longitude, strtok (NULL, "")); // Gets longitude
**strcpy (latitude, strtok (NULL, "")); // Gets latitude
**strcpy (dontuse, strtok (NULL, ""));
**strncpy (datetime, strtok (NULL, ""), 14); // Gets the date and time with 14 char

READING THE SERIAL DATA AND LAYING ON A STRING
Code:
read_string void () {
**index = 0;

**while (index <200) // Do not read unless options
****// There you know there is date
**{
****if (index <200) // One less than the size of the array
****{
******mySerial.read swell = (); // Read the character
******indata [index] = swell; // Store it
******index ++; // Increment where to write next
****}
**}
**indata [200] = '\ 0'; // Null terminate the string
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…