Hello,
i have a big problem wiht my Char String read. How can i check, if the String is ok?
I'm not sure, if there is any memory fault?
The Sketch is (83%) of dynamic memory using.
char lon[15];
char lat[15];
char Zeichen;
if (PortTwo.available() > 0)
{
int h=PortTwo.available();
for (int i=0;i<h;i++)
{
Zeichen =PortTwo.read();
if(Zeichen ==',')
{
index=0;
stepNext++;
}
else
{
switch (stepNext)
{
case 1:
lon[index] = Zeichen;
index++;
lon[index] = '\0'; // Null terminate the string
break;
case 2:
lat[index] =Zeichen;
index++;
lat[index] = '\0'; // Null terminate the string
break;
}
}
}
}
Serial.print("lon=");
Serial.print(lon); >> Result ->>4727.955814 - output correct!!!
doubleTemp = atof(lon);
Serial.print(lon); >>Result ->>4727.95 - wyh only 2 characters after point??
doubleTemp = strtod(lat,NULL);
Serial.print(lon); >>Result ->>4727.95 - wyh only 2 characters after point??