I have searched through this forum and other places, but cannot find the answer to what I would assume to be a fairly simple process.
I am trying to get GPS numbers into a string, but I cannot. I've used both TinyGPS and the Adafruit library and they appear to use a double and a float, respectively.
I have tried to some test code for a few different techniques of moving them into string. I'll post below:
void setup(){
Serial.begin(115200);
}
void loop(){
double lontemp=-92.1234;
double lattemp = 31.8765;
char latt[9];
char lon[9];
dtostrf(lontemp, 4, 4, lon); // I have tried several different set's of numbers here for width and precision
dtostrf(lattemp, 2, 6, latt);
Serial.print("Latitude is: ");
Serial.println(latt);
Serial.print("Longitude is: ");
Serial.println(lon);
}
output:
Latitude is: 31.876499
Longitude is:
Latitude is: 31.876499
Longitude is:
Also I have tried various different formatting techniques in sprintf , using the "ul" and "f" formatting parameters to no avail. I have written much in C since college, so I assume I am missing something easy. Thanks for any help.