Jump to content
venkatesh223

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++;
}
}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×