Jump to content
43oh

Splitting a string of data in Energia.


Recommended Posts

Hello there,

I connected a gps module and it gives me the gps data but im unable to segregate the following data on energia

+QGNSSRD: $GNRMC,044927.000,A,1301.7816,N,07731.3016,E,0.00,93.73,290319,,,A*4F

so i need to separate the latitude and longitude, time and date.

So can anybody help me in understanding how to get the required data from the above.

i attached my code below as you can see im getting stuck in the serial read please help me in correcting this.

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
char gps;
int times = 1;
int count = 0;
void setup()
{
Serial.begin(115200);
delay(2000);
Serial.println("AT");
delay(1000);
//Serial.println("AT+CMGF=1");
Serial.println("AT+QGNSSC?");
delay(1000);
 
Serial.println("AT+QGNSSC=1");
delay(1000);
 
Serial.println("AT+QGNSSTS?");
delay(1000);
 
}
void loop() {
  while(count < times)
  {
Serial.write("AT+QGNSSRD=\"NMEA/RMC\"");
delay(2000);
if(Serial.available() >0)
{
gps=Serial.read();
 String response = "";
response +=gps;
Serial.println(response);
return response;
}
count++;
}
}
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...