heyy its me again ... i tryied paulS code and it works perfect for the first marker /// but for some reson its not getting the secound number itryed several wayes to modify the code to accept 2 markere with no succes here is my last code it only print the first number :
boolean started = false;
boolean ended = false;
boolean started2 = false;
boolean ended2 = false;
char inData[24]; // Size as appropriate
byte index = 0;
char inData2[24];
byte index2 = 0;
void setup()
{
Serial.begin(9600);
}
void loop()
{
while(Serial.available() > 0)
{
char inChar = Serial.read();
if(inChar == '{' && inChar != '(' )
{
started = true;
index = 0;
inData[index] = '\0';
}
else if(inChar == '}')
{
ended = true;
break;
}
else if( inChar != '(')
{
if(index < 24-1) // Array size
{
inData[index++] = inChar;
inData[index] = '\0';
}
}
else if(inChar == '(')
{
started2 = true;
index2 = 0;
inData2[index2] = '\0';
}
else if(inChar == ')')
{
ended2 = true;
break;
}
else
{
if(index2 < 24-1) // Array size
{
inData2[index2++] = inChar;
inData2[index2] = '\0';
}
}
}
if(started && ended)
{
// Parse the data in inData here...
float lat1= atof(inData);
Serial.println(lat1,7);
delay(3000);
}
if(started2 && ended2)
{
// Parse the data in inData here...
float lon= atof(inData2);
Serial.println(lon,7);
delay(3000);
}
}