Im having some problems with parsing gps coordinates with the arduino ide.
To be honest I want to process the data without a library.
From my sensor I get this String: 4815.98450
The result of String.toDouble(): 4815.9843750
I also parsed it on my own, but i got the same result: (yes this code is not nice ;))
char buf[10];
msg.toCharArray(buf, 19);
double num = 0.0;
int c;
c = buf[0] - '0';
double num0 = (c * 1000);
c = buf[1] - '0';
double num1 = (c * 100);
c = buf[2] - '0';
double num2 = (c * 10);
c = buf[3] - '0';
double num3 = (c * 1);
c = buf[5] - '0';
double num5 = (c * 0.1);
c = buf[6] - '0';
double num6 = (c * 0.01);
c = buf[7] - '0';
double num7 = (c * 0.001);
c = buf[8] - '0';
double num8 = (c * 0.0001);
c = buf[9] - '0';
double num9 = (c * 0.00001);
num = num + num0;
num = num + num1;
num = num + num2;
num = num + num3;
num = num + num5;
num = num + num6;
num = num + num7;
num = num + num8;
num = num + num9;
Does somebody have a solution for my problems?
Thank you very much :=)